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?
You need to include the subfolder when you add the app to INSTALLED_APPS, for example:
'subFolder.appName',
or
'subfolder.appName.apps.AppNameConfig',
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'
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