SECRET_KEY设置不为空,但在Wa尾上返回为空

时间:2019-07-08 14:14:12

标签: django wagtail

我刚刚在项目中安装了wagtail-blog,并将 blog 添加到了INSTALLED_APPS,并将url(r'^blog/', include('blog.urls', namespace="blog")),添加到了主urls.py。迁移后,它返回了django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

我再次检查了base.py,它在SECRET_KEY上有一个字符串,但仍返回错误。这是MIDDLEWARE和INSTALLED_APPS

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'global',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail.contrib.styleguide',
'modelcluster',
'taggit',
'allauth',
'allauth.account',
'allauth.socialaccount',
'bootstrap3',
'copyright',
'landing',
'registration',
'blog',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'wagtail.core.middleware.SiteMiddleware',
    'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]

1 个答案:

答案 0 :(得分:0)

原来,我必须运行pip install -r requirements.txt来解决问题。