我试图在树莓派中使用Apache2和Mod-WSGI运行Flask,但我在此服务器上找不到请求的URL。我尝试编辑000-default.conf,但应用程序不支持Mod-WSGI。我用python 3
有人可以让我知道是什么问题吗?
谢谢,这是我来自apache2的身份:
这是app.wsgi:
#!/usr/bin/python3
import sys
sys.path.insert(0, '/var/www/html/prox')
from init import app as application
这是000-default.conf
Listen 5000
<VirtualHost *:5000>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/prox
LogLevel debug
WSGIScriptAlias / /var/www/html/prox/app.wsgi
WSGIDaemonProcess prox processes=5 threads=1 user=pi group=pi display-name=%{GROUP}
WSGIProcessGroup prox
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIChunkedRequest On
ErrorLog ${APACHE_LOG_DIR}/error-5000.log
CustomLog ${APACHE_LOG_DIR}/access-5000.log combined
<Directory /var/www/html/prox>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
该应用程序:名为app.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home_page():
return render_template('index.html')
app.debug = True
if __name__ == '__main__'
app.run()
我得到这个错误
例如,尝试在您的apache服务器上启动flask应用程序本身。
// Find your flask app
export FLASK_APP=<YOUR_FILE>
// Host it on your local network
flask run --host=0.0.0.0
这将启动服务器,确保您位于虚拟环境中,并且烧瓶应用程序存储在该目录中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句