I have 2 separate settings files for production and development and a common base.py settings file
base.py
SECRET_KEY = r" !@ #$%^&123456"
prod.py
from .base import * SECRET_KEY = os.environ['SECRET_KEY']
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.dev") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
When I enter this into the terminal:
python manage.py shell --settings=entri.settings.prod
I get an error message:
raise KeyError(key) KeyError: 'SECRET_KEY'
Help me, I'm new to django and python
python django keyerror
sidx
source share