Quantcast
Viewing all articles
Browse latest Browse all 22

Answer by Diaz for Django Import Error: No module named apps

First, check your manage.py and make sure it has the correct reference to myapp.

...apps/myapp/manage.py

...if __name__ == "__main__":    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")...

If the settings are correct, check the Python interpreter. If you're using virtualenv, errors can occur when you use the global Python instead of the virtual environment. The use of global Python can be caused by improperly setting up your IDE, user error or incorrect bin/bash in manage.py.

To make sure manage.py is running on the virtual env, check the first line in manage.py. By default the file reads:

#!/usr/bin python

Change that to:

#!/path/to/virtualenv/bin python

Now, check the Terminal and what Python version it's using. Then, activate the virtualenv:

[user@pc] #: source /path/to/virtualenv/bin/activate (venv) [user@pc] #: pip list

Confirm Django is installed. If it is and it's still not working correctly, then upgrade it with pip:

(venv) [user@pc] #: pip install --upgrade django

If none of the above works even though the Python version is correct, you're using the right Python environment and manage.py is set up correctly, then that means the error is somewhere else.


Viewing all articles
Browse latest Browse all 22

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>