在django中尝试使用manage.py运行服务器或迁移或使用该文件的任何内容时出现此错误。我的项目名称是网站和应用程序的名称是投资组合。请帮帮忙:)
错误:
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)
File "C:\Users\xxxx\.virtualenvs\website-o1OcjGMR\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\xxxx\.virtualenvs\website-o1OcjGMR\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\xxxx\.virtualenvs\website-o1OcjGMR\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\xxxx\.virtualenvs\website-o1OcjGMR\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\xxxx\.virtualenvs\website-o1OcjGMR\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "c:\users\xxxx\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 'portfoliodjango'
2条答案
按热度按时间0g0grzrc1#
检查您的INSTALLED_APPS,可能您在列出
portfolio
时遗漏了一个逗号cigdeys32#
找不到portfoliodjango文件。您必须在项目中导入此文件,或者只是拼写错误。
1.查看文件名是否正确/是否存在。
1.您是否以正确的方式从正确的位置导入?看看问题是不是这样的:
=> Python 3 ModuleNotFoundError: No module named 'lot'或
=> Relative imports - ModuleNotFoundError: No module named x
如果这些步骤不起作用,请提供portfoliodjango上的信息,例如您在何处使用此名称。