Reputation: 93
I've created new django app in a subdirectory using the command:
python manage.py startapp appName subFolder/appName
but if I try to add this app to INSTALLED_APPS at the end of the list I see the following error:
ImportError: No module named appName
Does anyone know what I am doing wrong?
Upvotes: 6
Views: 6678
Reputation: 2364
I tried different options but no one can solve that issue.
Finally, I found a solution.
Simply go to the subFolder/appName/apps.py
file and
replace this line name = 'appname'
with name = 'subfolder.appname'
And then you can simply add to the installed apps list in settings.py
.
'subfolder.appname'
Upvotes: 6
Reputation: 309099
You need to include the subfolder when you add the app to INSTALLED_APPS
, for example:
'subFolder.appName',
or
'subfolder.appName.apps.AppNameConfig',
Upvotes: 9