无法对apache2中的flask应用程序进行故障排除

时间:2019-07-10 06:15:30

标签: python linux apache2 mod-wsgi flask-restplus

我正在flask-restplus机器上使用Apache2mod_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')

0 个答案:

没有答案