Python/Django =-ModuleNotFoundError:没有名为"restaurants"的模块 [英] Python/Django =- ModuleNotFoundError: No module named 'restaurants'
本文介绍了Python/Django =-ModuleNotFoundError:没有名为"restaurants"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在执行python代码时,观察到以下错误跟踪.可能的原因 ModuleNotFoundError:没有名为餐厅"的模块
Following error trace is observed when python code is executed. Potential cause ModuleNotFoundError: No module named 'restaurants'
traceback (most recent call last):
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\utils\autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\site-packages\django\apps\config.py", line 94, in create
module = import_module(entry)
File "C:\Users\Archibald\Dev\trydjango1-11\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'restaurants'
推荐答案
我遇到了类似的问题.当我检查setting.py时,我发现我忘记了逗号.Seggust去检查一下..
I had a similar problem. When I checked setting.py , I saw I've forgot a comma. Seggust to go and check it..
INSTALLED_APPS = [
'home' , #This One was Missed
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
还要检查餐厅文件夹在哪里,它应该类似于:
And also check where is restaurant folder it should be similar to:
project|
|restaurant
|project
不是:
project|
|project|
|restaurant
这篇关于Python/Django =-ModuleNotFoundError:没有名为"restaurants"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文