Reputation:
I have a Django project that is setup to keep SECRET_KEY out of settings.py by setting my environment variable and then using the os.environ['SECRET_KEY']. I also use travis ci secure encrypted environment variables in order to have my SECRET_KEY for my django project accessible for travisci to use. The travisci builds successfully on my github account. However, travisci build will fail on anyone else who forks the code when trying to run python manage.py migrate/test with this error:
SECRET_KEY = os.environ['SECRET_KEY']
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/os.py", line 669, in __getitem__
raise KeyError(key) from None
KeyError: 'SECRET_KEY'
In the settings.py I have this line:
SECRET_KEY = os.environ['SECRET_KEY']
The .travis.yml file looks like this:
language: python
python:
- 3.6
env:
global:
- secure: # encrypted string for SECRET_KEY
- secure: # encrypted string for another settings KEY
- secure: # encrypted string for another settings KEY
install:
- pip install -r requirements/requirements.txt
script:
- flake8 --count --quiet
- python manage.py migrate --run-syncdb
- python manage.py test
Does anyone know if there is an issue with creating encrypted travis ci env variables and having others fork the code to also use those? I can't figure out why it works for me and doesn't work at all for any other github account with a fork of the same exact code.
Upvotes: 1
Views: 672
Reputation: 1
Have they exported their own secret key from their .bashrc? If they fork something with an environment variable, they'll need to generate their own secret key and add it in manually.
Upvotes: 0