我正在Elastic Beanstalk上成功部署我的Django(1.7),但当我在浏览器中加载它时,我得到了500个。在日志中我发现这个:在Amazon Elastic Beanstalk上部署Django。 LOGGING_INFO环境变量未设置
[Wed Sep 24 12:56:11.434509 2014] [:error] [pid 27030] [remote 172.31.6.176:0] mod_wsgi (pid=27030): Target WSGI script '/opt/python/current/app/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Sep 24 12:56:11.434557 2014] [:error] [pid 27030] [remote 172.31.6.176:0] mod_wsgi (pid=27030): Exception occurred processing WSGI script '/opt/python/current/app/mysite/wsgi.py'.
[Wed Sep 24 12:56:11.434596 2014] [:error] [pid 27030] [remote 172.31.6.176:0] Traceback (most recent call last):
[Wed Sep 24 12:56:11.434636 2014] [:error] [pid 27030] [remote 172.31.6.176:0] File "/opt/python/current/app/mysite/wsgi.py", line 14, in <module>
[Wed Sep 24 12:56:11.434698 2014] [:error] [pid 27030] [remote 172.31.6.176:0] application = get_wsgi_application()
[Wed Sep 24 12:56:11.434721 2014] [:error] [pid 27030] [remote 172.31.6.176:0] File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Wed Sep 24 12:56:11.434759 2014] [:error] [pid 27030] [remote 172.31.6.176:0] django.setup()
[Wed Sep 24 12:56:11.434781 2014] [:error] [pid 27030] [remote 172.31.6.176:0] File "/opt/python/run/venv/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
[Wed Sep 24 12:56:11.434813 2014] [:error] [pid 27030] [remote 172.31.6.176:0] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Wed Sep 24 12:56:11.434835 2014] [:error] [pid 27030] [remote 172.31.6.176:0] File "/opt/python/run/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 46, in __getattr__
[Wed Sep 24 12:56:11.434867 2014] [:error] [pid 27030] [remote 172.31.6.176:0] self._setup(name)
[Wed Sep 24 12:56:11.434886 2014] [:error] [pid 27030] [remote 172.31.6.176:0] File "/opt/python/run/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 40, in _setup
[Wed Sep 24 12:56:11.434916 2014] [:error] [pid 27030] [remote 172.31.6.176:0] % (desc, ENVIRONMENT_VARIABLE))
[Wed Sep 24 12:56:11.435013 2014] [:error] [pid 27030] [remote 172.31.6.176:0] ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
我将设置文件设置为像这样的.ebextension mysite.config文件。
- option_name: DJANGO_SETTINGS_MODULE
value: "mysite.settings"
我也加入了这个最文件:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
问题出在哪里我的设置文件应该怎么样子。我已经使用了这个好几个小时了,但我无法让它工作......我甚至不知道我的设置文件应该如何。现在它看起来像这样:
LOGGING_CONFIG = 'django.utils.log.dictConfig'
我很确定它是设置文件是问题。如果任何人都能指出我正确的方向,我会非常感激。
好吧有道理。出于某种原因它已设置,但设置不正确。 – Gustaf 2014-09-26 02:41:03