[Answered ]-Django "no module named myapp.models"

2👍

Assuming tbg is the name of your project, your project’s directory structure should be something like below:

tbg/  # your project's main folder
 |-- tbg/  # inner tbg folder which contains settings, urls, etc.
 |      __init__.py, settings.py, etc.
 |-- myapp/
        models.py, etc.

So when you are writing from tbg.myapp.models import Document, you are referring to the tbg folder inside your project’s main folder. As this tbg folder doesn’t have myapp folder, you are getting an error.

To fix this, write from myapp.models import Document.

👤xyres

Leave a comment