-1

我在运行命令 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.

有人可以帮助我吗?

谢谢

4

1 回答 1

1

我想都在这里: SECRET_KEY 设置不能为空。Django 文档

设置值 SECRET_KEY

于 2013-09-11T09:35:19.960 回答