![](/img/trans.png)
[英]Django, Celery Supervisor: Secret Key Error: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty
[英]getting error : django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty in django
當我嘗試運行django
時,出現錯誤django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty
, there already SECRET_KEY exist in settings.py file SECRET_KEY = 'g1tmo148kxtw#^obw&apoms%n=&4g+2qi1ssuc$v3(fig-he4u'
仍然出現錯誤,誰能幫我解決這個問題?
設置.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
只需刪除setting.py
文件中的django.setup()
即可。
為了更清楚地說明,當django.setup()
時,它應該已經有一個設置文件,因此有一個SECRET_KEY
; 所以它引發了這樣的錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.