gpt4 book ai didi

python - SECRET_KEY 设置不能为空

转载 作者:太空宇宙 更新时间:2023-11-04 10:09:52 27 4
gpt4 key购买 nike

在cmd中运行服务器时出现错误

我使用的是 Windows 7、Python 版本 3.4.3 和Django 版本 1.8。

> 
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 338, in execute_f
rom_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 190, in fetch_com
mand
klass = load_command_class(app_name, subcommand)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 40, in load_comma
nd_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\django\core\management\commands\runserver.py", line 14, in
<module>
from django.db.migrations.executor import MigrationExecutor
File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 6, in <module>
from .loader import MigrationLoader
File "C:\Python34\lib\site-packages\django\db\migrations\loader.py", line 10, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "C:\Python34\lib\site-packages\django\db\migrations\recorder.py", line 9, in <module>
class MigrationRecorder(object):
File "C:\Python34\lib\site-packages\django\db\migrations\recorder.py", line 23, in MigrationRec
order
class Migration(models.Model):
File "C:\Python34\lib\site-packages\django\db\migrations\recorder.py", line 24, in Migration
app = models.CharField(max_length=255)
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 1081, in __init_
_
super(CharField, self).__init__(*args, **kwargs)
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 161, in __init__

self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__
self._setup(name)
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\abc\Desktop\myapp\myapp\settings.py", line 16, in <module>
import django.contrib.auth
File "C:\Python34\lib\site-packages\django\contrib\auth\__init__.py", line 7, in <module>
from django.middleware.csrf import rotate_token
File "C:\Python34\lib\site-packages\django\middleware\csrf.py", line 14, in <module>
from django.utils.cache import patch_vary_headers
File "C:\Python34\lib\site-packages\django\utils\cache.py", line 26, in <module>
from django.core.cache import caches
File "C:\Python34\lib\site-packages\django\core\cache\__init__.py", line 34, in <module>
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__
self._setup(name)
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python34\lib\site-packages\django\conf\__init__.py", line 113, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

最佳答案

是Django版本不兼容的问题。当我安装 1.5 版和 1.9 版的 django 时,它可以工作,但不能用于 1.10 和 1.8

关于python - SECRET_KEY 设置不能为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39014009/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com