Reputation: 1673
When i try to run django
, i am getting error django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty
, there is already SECRET_KEY exist in settings.py file SECRET_KEY = 'g1tmo148kxtw#^obw&apoms%n=&4g+2qi1ssuc$v3(fig-he4u'
still i am getting the error, can anyone please help me how to resolve this issue ?
settings.py
import django
django.setup()
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'g1tmo148kxtw#^obw&apoms%n=&4g+2qi1ssuc$v3(fig-he4u'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Upvotes: 0
Views: 77
Reputation: 3930
Just remove the django.setup()
on your setting.py
file and you're good to go.
To clarify it more, when django.setup()
is called, it should already have a settings file, and therefore a SECRET_KEY
; So it raise such an error.
Upvotes: 1