Question

I'm testing my project using pylint and currently getting fatal error when importing the internal apps into the project using.

According to pylint, the import should be something like from <appname>.models import ... as opposed to what I currently have: from <projectname>.<appname>.models import My problem is that when I use the recommended style, the project can't find/import the app. What am I missing here?

Was it helpful?

Solution

Your apps are not in the python path.

Seems like you have a folder for apps, like apps/registration, apps/contact_form etc. and your manage.py is in the folder on top of that one, which has just the project folder.

manage.py does some "magic" by putting all the apps into the python path before starting the server.

If you have custom folder structure, you should edit the manage.py to include your custom apps folder in the python path, preferably as the first element of the python path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top