我正在运行django框架,但出现此错误,我在线检查但未找到任何解决方案
这是显示的错误
Traceback (most recent call last):
File "manage.py", line 16, in <module>
execute_from_command_line(sys.argv)
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\site-packages\django\core\management\__init__.py", line 317, in execute
settings.INSTALLED_APPS
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\site-packages\django\conf\__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\site-packages\django\conf\__init__.py", line 106, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files (x86)\Emacs\.virtualenvs\back-97G-SXVS\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\_monster\Desktop\skill\djember_cookiecutter\djember_test\back\settings.py", line 161, in <module>
if DEBUG:
NameError: name 'DEBUG' is not defined
所以有人有什么主意吗?
答案 0 :(得分:0)
回溯表明您在项目的if DEBUG:
文件中的第161行有一个语句(settings.py
),该语句调用了脚本命名空间中的未定义变量。
通常在DEBUG
中定义settings.py
。也许您在声明变量之前尝试使用它?或DEBUG
都没有定义。
答案 1 :(得分:0)
缺少您的 settings.py DEBUG
变量。放在那里。
DEBUG = True #True for development, False for deployment