我正在flask-restplus
机器上使用Apache2
和mod_wsgi
来建立Linux
应用程序。我已经为我的应用程序和wsgi文件创建了virtualHost
。当我运行apache时,我可以看到在我的virtualhost
中指定的CustomLog文件已创建,但是文件是空的。当我打服务器时,出现404 Not Found
错误。
我的虚拟主机文件如下。
<VirtualHost *>
ServerName 127.0.0.1
ErrorLog /win-share/logs/error.log
CustomLog /win-share/logs/aedmodeling.log common
WSGIDaemonProcess aedmodeling
WSGIScriptAlias / /win-share/AED-modeling/web.wsgi
<Directory /win-share/AED-modeling>
WSGIProcessGroup aedmodeling
WSGIApplicationGroup %{GLOBAL}
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
我的 wsgi文件看起来像
import sys
import os
virtual_env_path = os.path.join(os.path.join('aed-modeling-
env','bin'),'activate_this.py')
project_path= os.path.realpath(os.path.dirname(__file__))
activate_this =
os.path.join(os.path.join(project_path,'..'),virtual_env_path)
exec(compile(open(activate_this).read(), activate_this, 'exec'),
dict(__file__=activate_this))
sys.path.insert(0,project_path)
from Server import app
application=app
和我的烧瓶应用程序在Server.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(host='0.0.0.0')