# Environment Variables Django app

**URL:** <https://travis-ci.community/t/environment-variables-django-app/12547>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [December 29, 2021, 5:44pm UTC](https://travis-ci.community/t/environment-variables-django-app/12547 "2021-12-29T17:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukaszRemkowicz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/lukaszremkowicz/32/7550_2.png) [@LukaszRemkowicz](https://travis-ci.community/u/LukaszRemkowicz)\
**Post date:** [December 29, 2021, 5:44pm UTC](https://travis-ci.community/t/environment-variables-django-app/12547/1 "2021-12-29T17:44:06Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![LukaszRemkowicz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/lukaszremkowicz/32/7550_2.png) [@LukaszRemkowicz](https://travis-ci.community/u/LukaszRemkowicz)\
**Post date:** [December 29, 2021, 8:35pm UTC](https://travis-ci.community/t/environment-variables-django-app/12547/2 "2021-12-29T20:35:58Z")

</div>

Problem solved. I had to add secret\_key to docker environment.

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [December 29, 2021, 10:54pm UTC](https://travis-ci.community/t/environment-variables-django-app/12547/3 "2021-12-29T22:54:15Z")

</div>

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.
