问题出在这里。 我想部署我的烧瓶应用程序在apache2.4服务器使用mod_wsgi.After配置,我的apache服务器开始在我的电脑上运行。但是当我访问http://127.0.0.1:5000/页面不显示为我的愿望。在windows上的apache上运行烧瓶
这是我的烧瓶代码。
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return "Hello World!"
if __name__ == '__main__':
app.run(port=5000)
这是我的虚拟主机配置。
<VirtualHost *:5000>
ServerAdmin [email protected]
DocumentRoot C:\flask
WSGIScriptAlias/C:\flask\test.wsgi
<Directory "C:\flask">
Require all granted
Require host ip
Allow from all
</Directory>
</VirtualHost>
我的wsgi代码。
import sys
#Expand Python classes path with your app's path
sys.path.insert(0, "C:/flask")
from test import app as application
#Put logging code (and imports) here ...
#Initialize WSGI app object
application = app
的页面是这样的: It says 'Internal Server Error'.
谢谢大家!
Apache错误日志说什么?如果没有,请将'app.debug = True'添加到WSGI脚本文件中,以查看Flask是否会在Flask生成时显示错误的详细信息。 –
您是如何在非UNIX平台上安装mod_wsgi的? – mmenschig
@GrahamDumpleton询问这个问题后,我转向apache错误日志,发现它说“名称”应用程序'没有定义“,所以我删除了wsgi代码中的'as application',它工作正常! – coma