【发布时间】:2019-06-30 14:01:07
【问题描述】:
我在我的网页无法呈现的 pythonanywhere 上遇到了这个问题。我怀疑这是 DJANGO_SETTINGS_MODULE 的问题,但我似乎无法让它工作。
还尝试使用“Wagtail-Onepage-Portfolio.settings”,但也没有用。
import os
import sys
path = '/home/webconexus/portfolio/portfolio/Wagtail-Onepage-Portfolio'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'portfolio.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
这是/var/www/www_rafrasenberg_nl_wsgi.py
Error running WSGI application
2019-02-06 14:58:00,884: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2019-02-06 14:58:00,884: File "/var/www/www_rafrasenberg_nl_wsgi.py", line 12, in <module>
2019-02-06 14:58:00,884: application = get_wsgi_application()
2019-02-06 14:58:00,884:
2019-02-06 14:58:00,884: File "/home/webconexus/portfolio/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-02-06 14:58:00,884: django.setup(set_prefix=False)
2019-02-06 14:58:00,884:
2019-02-06 14:58:00,885: File "/home/webconexus/portfolio/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
2019-02-06 14:58:00,885: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2019-02-06 14:58:00,885:
2019-02-06 14:58:00,885: File "/home/webconexus/portfolio/lib/python3.7/site-packages/django/conf/__init__.py", line 57, in __getattr__
2019-02-06 14:58:00,885: self._setup(name)
2019-02-06 14:58:00,885:
2019-02-06 14:58:00,885: File "/home/webconexus/portfolio/lib/python3.7/site-packages/django/conf/__init__.py", line 44, in _setup
2019-02-06 14:58:00,885: self._wrapped = Settings(settings_module)
2019-02-06 14:58:00,885:
2019-02-06 14:58:00,886: File "/home/webconexus/portfolio/lib/python3.7/site-packages/django/conf/__init__.py", line 126, in __init__
2019-02-06 14:58:00,886: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2019-02-06 14:58:00,886: ***************************************************
2019-02-06 14:58:00,886: If you're seeing an import error and don't know why,
2019-02-06 14:58:00,886: we have a dedicated help page to help you debug:
2019-02-06 14:58:00,886: https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-02-06 14:58:00,886: ***************************************************
【问题讨论】:
标签: python django wsgi pythonanywhere