django.core.exceptions.ImproperlyConfigured:SECRET_KEY设置不能为空。什么时候在settings.py中完成

时间:2016-10-06 03:26:28

标签: python django

我有一个问题让我的django在服务器上。这是追溯。

Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    import AuShadha.startup as startup
  File "/home/vagrant/venv/AuShadha/src/AuShadha/AuShadha/startup.py", line 19, in <module>
from AuShadha import settings
  File "/home/vagrant/venv/AuShadha/src/AuShadha/AuShadha/settings.py", line 8, in <module>
django.setup()
  File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/__init__.py", line 22, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
  File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
  File "/home/vagrant/venv/local/lib/python2.7/site-packages/django    /conf/__init__.py", line 116, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

这里是settings.py

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'jbnlwhbvwdvilibbfwlhbwhbvccvjlanoajhfjdofffofoewfbwfho'

这也不是我的实际密钥

这里是manage.py

#!/usr/bin/env python
import os
import sys

def fix_reload(v):
    if '--noreload' in v: return v
    if v[1] == 'runserver':
        return v[:2] + ['--noreload'] + v[2:]
    return v

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "AuShadha.settings")


print "Trying to run custom code at startup..."
print "Loading apps and roles from configure.yaml"
import AuShadha.startup as startup
startup.run()
print "Roles for UI loaded"

from django.core.management import execute_from_command_line

sys.argv = fix_reload(sys.argv)
execute_from_command_line(sys.argv

根据以下一些用户的要求。我设置了几个不同的文件架构,即在venv内部和外部,如果这对任何人都有帮助

0 个答案:

没有答案