I'm learning Django... And there is an error I'm not able to fix when running makemigrations
command.
I got the error 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
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.
I modified the models.py
of idmp_core
directory. 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. 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',
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With