I\'m using Ubuntu 10.04.
I create a django project under /home/wong2/Code/python/django2/ named atest
and create a wsgi file setting.
You may get a surprise where your WSGI has its home directory! On my admittedly naive wsgi_mod installation, it is / - I was so surprised I had to write this script to make sure:
import os
def application(environ, start_response):
status = '200 OK'; e=os.listdir(os.getcwd())
output = '''WSGI %s
'''%(e)
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
That means imported applications will need a full path to be found, e.g.:
sys.path.append('/home/foo/www/Forms')
from DataCommon import page
This is the recommended (by Google) approach to this:
import sys; path='/home/foo/www/Forms';
if path not in sys.path: sys.path.append(path)