我的data_site.wsgi文件:
import main
application = application()
我遇到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
路径:
htdocs
data_site.wsgi
main.py
答案 0 :(得分:3)
mod_wsgi下的PYTHONPATH不包含.wsgi所在的目录。我经常在我的.wsgi文件中使用类似下面的内容。
import os, sys; sys.path.append(os.path.dirname(__file__))
(您可以选择。插入(0,...)而不是.append(...),如果这对您更有效。)