我一直在关注这个(http://appsembler.com/blog/django-deployment-using-openshift/)教程,用python 2.7和mysql 5.1部署mezzanine 3.0.9
在我发出http请求后进行部署后,我收到以下错误日志:
[Sat Mar 22 00:44:31 2014] [error] /var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Mezzanine-3.0.9-py2.7.egg/mezzanine/utils/conf.py:51: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django 1.5 requires. Will fall back to the domains configured as sites.
[Sat Mar 22 00:44:31 2014] [error] warn("You haven't defined the ALLOWED_HOSTS settings, which "
[Sat Mar 22 00:44:53 2014] [error] /var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Mezzanine-3.0.9-py2.7.egg/mezzanine/utils/conf.py:59: UserWarning: TIME_ZONE setting is not set, using closest match: America/New_York
[Sat Mar 22 00:44:53 2014] [error] warn("TIME_ZONE setting is not set, using closest match: %s" % tz)
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] mod_wsgi (pid=501717): Exception occurred processing WSGI script '/var/lib/openshift/532c9876e0b8cdcdeb0001c8/app-root/runtime/repo/wsgi/application'.
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] Traceback (most recent call last):
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] File "/var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/handlers/wsgi.py", line 187, in __call__
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] self.load_middleware()
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] File "/var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/handlers/base.py", line 46, in load_middleware
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] File "/var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/conf/__init__.py", line 54, in __getattr__
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] self._setup(name)
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] File "/var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/conf/__init__.py", line 49, in _setup
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] self._wrapped = Settings(settings_module)
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] File "/var/lib/openshift/532c9876e0b8cdcdeb0001c8/python/virtenv/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/conf/__init__.py", line 151, in __init__
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
[Sat Mar 22 00:44:53 2014] [error] [client 127.8.79.129] ImproperlyConfigured: The SECRET_KEY setting must not be empty.
这是我的settings.py(http://pastebin.com/uJT6VVmm)& wsgi / application file(http://pastebin.com/21DBpUgp)。
你能帮我解决这个问题。
由于
答案 0 :(得分:2)
我认为您已跳过Django文档的this part。如果settings.py中不存在SECRET_KEY
,则默认为空。
SECRET_KEY
命令时会生成 startproject
。因此,请确保SECRET_KEY
或settings.py
文件中包含local_settings.py
。
答案 1 :(得分:0)
我刚创建了一个quickstart用于在openshift上设置夹层,我还创建了there一个非常详细的描述如何从头开始设置夹层。根据我的经验设置,这里是我对settings.py
的修改:
SECRET_KEY
和NEVERCACHE_KEY
ALLOWED_HOSTS
以包含.rhcloud.com