views:

55

answers:

1

My data_site.wsgi file:

import main
application = application()

Error i get at apache:

[Thu Apr 29 07:07:41 2010] [error] [client 81.167.201.136] Traceback (most recent call last):
[Thu Apr 29 07:07:41 2010] [error] [client 81.167.201.136]   File "/var/www/vhosts/data.oddprojects.net/htdocs/data_site.wsgi", line 1, in <module>
[Thu Apr 29 07:07:41 2010] [error] [client 81.167.201.136]     import main
[Thu Apr 29 07:07:41 2010] [error] [client 81.167.201.136] ImportError: No module named main

Paths:

htdocs
  data_site.wsgi
  main.py
+3  A: 

The PYTHONPATH under mod_wsgi doesn't include the directory the .wsgi is in. I often use something like the below in my .wsgi files.

import os, sys; sys.path.append(os.path.dirname(__file__))

(You might opt for .insert(0, ...) instead of .append(...) if that works better for you.)

djc