为什么命令 python manage.py runserver 不工作?

所以,昨天当我编码时一切都很好但现在每当我运行命令时 -


python manage.py runserver


出现此错误 -


Traceback (most recent call last):



File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv

    self.execute(*args, **cmd_options)

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute

    super().execute(*args, **options)

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\core\management\base.py", line 369, in execute

    output = self.handle(*args, **options)

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle

    if not settings.DEBUG and not settings.ALLOWED_HOSTS:

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\conf\__init__.py", line 76, in __getattr__

    self._setup(name)

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\conf\__init__.py", line 63, in _setup

    self._wrapped = Settings(settings_module)

  File "C:\Users\LENOVO\anaconda3\lib\site-packages\django\conf\__init__.py", line 142, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "C:\Users\LENOVO\anaconda3\lib\importlib\__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

  File "<frozen importlib._bootstrap>", line 983, in _find_and_load

  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'editdojo_project.settings'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "manage.py", line 21, in <module>

    main()

  File "manage.py", line 17, in main

    execute_from_command_line(sys.argv)

我不知道这个错误是什么意思,另一个问题是我可以在不运行 runserverpython manage.py命令的情况下查看我的网站,这真的很奇怪,因为如果我们在不运行 runserverpython manage.py命令的情况下运行它,它通常会显示 404 页面未找到错误。


富国沪深
浏览 268回答 1
1回答

桃花长相依

如果您打开错误的路径来运行 manage.py 模块,则可能会发生这种情况,另一个原因可能是您的根路径中缺少 __ init __.py 模块
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python