We usually set up our projects as follows:
/site/ __init__.py manage.py settings.py urls.py /apps/ __init__.py /appA/ __init__.py /appB/ __init__.py /lib/ __init__.py /django-lib/ __init__.py /shared-lib/ __init__.py
Just make sure your site directory is in your python path:
import sys sys.path.append('/path/to/site/')
Also, make sure init.py exists on the site, in applications, and in lib, so you can think of them as modules using dot notation import (import site.lib.shared-lib)
Edit:
In answer to your question regarding your python path, all this is related to where your manage.py file or equivalent is located. If it is in the / site / directory (next to applications and lib), then PYTHONPATH should be fine.
You need to make sure that each directory contains an empty file named __init__.py . This tells Python to treat this directory as a module. See New and Improved ASCII Art above.
Josh Smeaton
source share