[英]Django / makemigrations ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango';
I'm learning Django... And there is an error I'm not able to fix when running makemigrations
command.我正在学习 Django...并且在运行
makemigrations
命令时有一个我无法修复的错误。
I got the error ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
我收到错误
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
. ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
。 What is puzzling me is the django
word appened at the end of idmp_core.apps.IdmpCoreConfig
string that is part of令我困惑的是
idmp_core.apps.IdmpCoreConfig
字符串末尾idmp_core.apps.IdmpCoreConfig
的django
词,它是
INSTALLED_APPS = [
'idmp_core.apps.IdmpCoreConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
My project tree structure is the following one:我的项目树结构如下:
D:.
| manage.py
|
+---idmp_core
| | admin.py
| | apps.py
| | models.py
| | tests.py
| | urls.py
| | views.py
| | __init__.py
| |
| +---migrations
| | __init__.py
|
+---idmp_v0
| | settings.py
| | urls.py
| | wsgi.py
| | __init__.py
|
\---templates
I created the idmp_core
using python manage.py startapp idmp_core
and that went well.我使用
python manage.py startapp idmp_core
创建了idmp_core
并且进展顺利。
I modified the models.py
of idmp_core
directory.我修改了
idmp_core
目录的models.py
。 And when I run the command当我运行命令时
python manage.py makemigrations idmp_core
I get following error message我收到以下错误消息
(idmp) D:\Dropbox\mycode\idmp_v0>python manage.py makemigrations idmp_core
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\core\management\__init__.py", line 347, in execute
django.setup()
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "C:\Users\JMERX\Envs\idmp\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 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
When I followed a Django tutorial, everything was fine.当我遵循 Django 教程时,一切都很好。 I did a mistake... But I'm not able to understand where...
我犯了一个错误......但我无法理解在哪里......
You just forgot to put a comma in there你只是忘了在那里放一个逗号
Here you go干得好
INSTALLED_APPS = [
'idmp_core.apps.IdmpCoreConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
I'm learning Django... And there is an error I'm not able to fix when running makemigrations
command.我正在学习Django ...并且运行
makemigrations
命令时出现无法修复的错误。
I got the error ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
我收到错误
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
. ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
。 What is puzzling me is the django
word appened at the end of idmp_core.apps.IdmpCoreConfig
string that is part of令我感到困惑的是在单词
idmp_core.apps.IdmpCoreConfig
字符串的末尾添加的django
词,它是
INSTALLED_APPS = [
'idmp_core.apps.IdmpCoreConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
My project tree structure is the following one:我的项目树结构如下:
D:.
| manage.py
|
+---idmp_core
| | admin.py
| | apps.py
| | models.py
| | tests.py
| | urls.py
| | views.py
| | __init__.py
| |
| +---migrations
| | __init__.py
|
+---idmp_v0
| | settings.py
| | urls.py
| | wsgi.py
| | __init__.py
|
\---templates
I created the idmp_core
using python manage.py startapp idmp_core
and that went well.我使用
python manage.py startapp idmp_core
创建了idmp_core
,一切顺利。
I modified the models.py
of idmp_core
directory.我修改了
idmp_core
目录的models.py
。 And when I run the command当我运行命令时
python manage.py makemigrations idmp_core
I get following error message我收到以下错误消息
(idmp) D:\Dropbox\mycode\idmp_v0>python manage.py makemigrations idmp_core
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\core\management\__init__.py", line 347, in execute
django.setup()
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\Users\JMERX\Envs\idmp\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "C:\Users\JMERX\Envs\idmp\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 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'idmp_core.apps.IdmpCoreConfigdjango'; 'idmp_core.apps' is not a package
When I followed a Django tutorial, everything was fine.当我遵循Django教程时,一切都很好。 I did a mistake... But I'm not able to understand where...
我犯了一个错误...但是我不明白在哪里...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.