python manage.py syncdb错误

时间:2013-09-11 09:34:15

标签: python django ubuntu python-2.7 django-models

我们在运行命令python manage.py syncdb时遇到以下错误:

Traceback (most recent call last):

  File "manage.py", line 11, in <module>
    execute_manager(settings)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 469, in execute_manager
    utility.execute()

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))

  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in <module>
    from django.db import models

  File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 11, in <module>
    if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
    self._setup(name)

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup
    self._wrapped = Settings(settings_module)

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 152, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

有人可以帮助我吗?

谢谢

1 个答案:

答案 0 :(得分:1)

我认为这一切都在这里: SECRET_KEY设置不能为空。 Django docs

设置值SECRET_KEY