本文介绍了获取“不正确配置:SECRET_KEY设置不能为空”。在开启时部署夹层3.0.9时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在追踪()教程部署夹层3.0.9与python 2.7和mysql 5.1

I have been following this (http://appsembler.com/blog/django-deployment-using-openshift/) tutorial to deploy mezzanine 3.0.9 with python 2.7 and mysql 5.1

部署后,我发出http请求我是获取以下错误日志:

After deploy when I make the http request I am getting following error logs:

[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()& wsgi /应用程序文件()。

Here is my settings.py (http://pastebin.com/uJT6VVmm) & wsgi/application file (http://pastebin.com/21DBpUgp).

可以帮我解决问题。

谢谢

推荐答案

我想你已经跳过了这部分 Django文档。如果settings.py中不存在 SECRET_KEY ,则默认为空。

I think you have skipped this part of Django Documentation . If SECRET_KEY is not present in settings.py , by default its empty .

SECRET_KEY 在使用 startproject 命令时生成。所以请确保您的 settings.py 或 local_settings.py 中有 SECRET_KEY code>文件。

SECRET_KEY is generated when you use startproject command. So make sure you have SECRET_KEY in your settings.py or or local_settings.py file .

这篇关于获取“不正确配置:SECRET_KEY设置不能为空”。在开启时部署夹层3.0.9时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 00:14