19👍
✅
After you have logged into heroku with heroku login you can check your configs by running:
heroku config
.
If you dont see a SECRET_KEY
and DJANGO_SETTINGS_MODULE
you can set them by running:
heroku config:set SECRET_KEY='secret_key_goes_here'
and
heroku config:set DJANGO_SETTINGS_MODULE=mysite.settings.production
Finally, make sure that you have the following syntax inside of your production setting file:
SECRET_KEY = os.environ['SECRET_KEY']
The above intstructions are for the following project structure
-myproject
-app1
-app2
-mysite
-settings
__init__.py
base.py
dev.py
production.py
-manage.py
-Pipfile
-Procfile
-requirements.txt
9👍
You can use the environment variable DJANGO_SETTINGS_MODULE
to specify a default settings module:
https://docs.djangoproject.com/en/dev/topics/settings/#envvar-DJANGO_SETTINGS_MODULE
On local Linux machine:
export DJANGO_SETTINGS_MODULE=settings.local
On Heroku:
heroku config:set DJANGO_SETTINGS_MODULE=settings.production
- [Django]-Copy file from one model to another
- [Django]-Select distinct values from a table field
- [Django]-What is reverse()?
Source:stackexchange.com