I am currently attempting to update django from 1.4 to 2.0 after many syntax corrections I have run into this error when trying to run the server. I am updating django by having installed the latest version on my previous directory.
From everything that ive read online, the SECRET_KEY
should be set in the settings.py
which it is in my case.
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Here is a snippet of where I am defining the SECRET_KEY variable as well as commented out attempts of what I have tried in my settings.py:
# Examples: "http://foo.com/media/", "/media/".
if versionNumber >= 1.3 and revisionNumber >= 3.1:
STATIC_URL = '/media/'
else:
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
#print ('before the SECRET KEY is defined')
#SECRET_KEY=os.environ.get("SECRET_KEY", 'tk1@!52kv9m(1hf5*t$q6e0am&1yon*-hlet0a+m975zg9a0)c')
SECRET_KEY='tk1@!52kv9m(1hf5*t$q6e0am&1yon*-hlet0a+m975zg9a0)c'
#print ('after the secret key is defined ',SECRET_KEY)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
(
'django.template.loaders.cached.Loader',
If anyone has any resolutions please let me know as I have been struggling with this error for a couple of days now. I understand this may be an issue in the way I am updating so if anyone has more in depth information on updating django that would be very helpful as well.