2010-04-29 84 views
1

我data_site.wsgi文件:嘗試在運行Apache WERKZEUG(WSGI錯誤)

import main 
application = application() 

錯誤我得到阿帕奇:

[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 

回答

3

的PYTHONPATH在mod_wsgi下不包含.wsgi所在的目錄。我經常在我的.wsgi文件中使用類似下面的內容。

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

(您可能會選擇.insert(0,...),而不是.append(...)是否適合你更好。)

相關問題