【发布时间】:2016-03-01 17:31:59
【问题描述】:
我想在 apache 上部署我的 python 应用程序,所以我制作了一个 hello world 应用程序(包含在一个 python 文件中)并从那里导入应用程序对象并且它工作。这只是为了测试一下。
然后我将我的应用程序文件移到那里并尝试使用它。我尝试导入应用程序对象(现在从 python 包中),没有任何问题,但是当我访问服务器时,我得到一个 500 错误代码。 注意:如果我使用 python 运行该应用程序,它就可以正常工作。它没有损坏。
文件结构:
app.wsgi main(this is the python package) hello.py(this is the simple app)
在 app.wsgi 我有这个:
import sys
sys.path.append('/var/www/html')
from hello import app as application
这行得通,但是当我将其更改为:
import sys
sys.path.append('/var/www/html')
from main import app as application
它给了我 500。
关于为什么会发生这种情况的任何想法?
【问题讨论】: