views:

26

answers:

1

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?

A: 

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.

Lakshman Prasad
Not sure if this is the problem, asI don't have a folder for apps. I don't know if this helps but the problem only occurs when running the project using mod_wsgi...using the inbuilt Django dev server, everything is good
Stephen
There you go. You need to customize the sys.path inside your mod_wsgi file.
Lakshman Prasad
Thnx Lakshman...I figured that bit on the mod_wsgi after posting the first comment...made the changes and it works like a charm
Stephen