gpt4 book ai didi

python - 尝试运行 Django-admin dbshel​​l 时出错,没有名为 'myprojectname' 的模块

转载 作者:行者123 更新时间:2023-11-29 15:45:29 25 4
gpt4 key购买 nike

我已经尝试了几个小时来消除这个错误,但我真的很茫然。当我运行尝试设置设置环境时,它失败了。我不知道我在这里做错了什么。我不知道找不到该模块意味着什么。设置文件显然在那里。

set DJANGO_SETTINGS_MODULE=Hyper_Web_App_Directory.settings
Django-admin runserver

导致此错误

(venv) C:\Users\unblo\PycharmProjects\Hyper_Web_App_Directory>set DJANGO_SETTINGS_MODULE=Hyper_Web_App_Directory.settings

(venv) C:\Users\unblo\PycharmProjects\Hyper_Web_App_Directory>Django-Admin runserver
Traceback (most recent call last):
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\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\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\unblo\AppData\Local\Programs\Python\Python37-32\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 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'Hyper_Web_App_Directory'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\unblo\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\unblo\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\unblo\PycharmProjects\Hyper_Web_App_Directory\venv\Scripts\django-admin.exe\__main__.py", line 9, in <module>
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\db\utils.py", line 213, in __iter__
return iter(self.databases)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\db\utils.py", line 147, in databases
self._databases = settings.DATABASES
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "c:\users\unblo\pycharmprojects\hyper_web_app_directory\venv\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\unblo\AppData\Local\Programs\Python\Python37-32\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 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'Hyper_Web_App_Directory'

最佳答案

您能发布您的项目结构吗?它正在尝试从 Hyper_Web_App_Directory 目录导入设置文件,但找不到该目录。它也可能是区分大小写的,因为我在回溯中看到目录列为“hyper_web_app_directory”。尝试将设置模块设置为相同的内容,但 Hyper_Web_App_Directory 全部小写。

关于python - 尝试运行 Django-admin dbshel​​l 时出错,没有名为 'myprojectname' 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57104843/

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