Environment Variables Django app

Hey, could someone explain me, why Environment Variables doesnt work for django app? I’m using in my code command (settings.py):

SECRET_KEY = os.getenv('SEC_KEY')

and got set SECRET_KEY in my travis project settings. But still im getting error, that secret key must not be empty. Can someone explain me how it work? Why variables are not exported to my project?

Problem solved. I had to add secret_key to docker environment.

Hello @LukaszRemkowicz,

If you’re using Docker, you need to add the SECRET_KEY environment variable to DockerHub and that will work for your Django app. I see that you’ve figured this out, but it is worth noting.

2 Likes
Imprint