Django Import Error: No Module Named Apps
Solution 1:
You need to add an empty __init__.py
(4 underscores in total) file in the apps
folder for it to be recognized by Python as a package.
Have a look at the documentation for more informations.
Solution 2:
If you've used the django-admin startapp myapp
command, it creates this file: myapp/apps.py
.
It could be conflicting with your apps/
module folder. A hidden apps.pyc
file could be in your myapp/
folder.
Try removing these:
project/apps/myapp/apps.py
project/apps/myapp/apps.pyc
Solution 3:
Note that in Django 1.9 there is a module called django.apps
Avoiding name clashes with built-in modules is generally advised
Solution 4:
This can also happen if you installed your app in settings.py
in your main project folder, before running this:
python manage.py startapp [app-name]
Comment it out, create the app (should work now), then put the line back into the settings.py
file and continue on.
Solution 5:
Note that in Django 1.9
, you can add your app into the INSTALLED_APPS
list.
If your app name is app
and you have created models in it, then go to the settings.py
file and add your app:
INSTALLED_APPS = [
...
'app'
]
Post a Comment for "Django Import Error: No Module Named Apps"