为什么 apache 抛出 Target WSGI script not found or unable to stat on Flask app?

Why apache throws Target WSGI script not found or unable to stat on Flask app?

我想在我的 ubuntu 服务器上使用 wsgi 为 apache 设置我的烧瓶应用程序。但是在我设置之后,我收到以下浏览器错误:

Not Found
The requested URL / was not found on this server.

apache 错误日志抛出:

Target WSGI script not found or unable to stat: 
    /var/www/html/appname/appname.wsgi

我的 wsgi 文件如下所示:

#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/html/appname/")

from IdeaHound import app as application
application.secret_key = 'here_the_key'

我的 Apache 配置文件如下所示:

<VirtualHost *:80>
                ServerName server_ip_here
                WSGIScriptAlias / /var/www/html/appname/appname.wsgi
                <Directory /var/www/html/appname/>
                        Order allow,deny
                        Allow from all
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel info
                CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

appname 文件夹具有以下结构: 应用名称

--application.py
--appname.wsgi
--LICENSE
--README.md
--requirements.txt
--db_manage.py
--appname
----frontend
----__inity__.py
----__init__.pyc
----models
----__pycache__
----socket_interface
--AppName
----__init__.py
----static
----templates
--instance
----config.py

为了使用 Flask 正确制作网络服务器 运行 我在这里缺少什么?

请阅读以下link Digital Ocean。按照里面的描述去做。您的应用程序将在 5 分钟内启动并运行。

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps

如果仍然抛出错误,请检查 apache 错误日志以获取更多信息。

/var/log/apache2/error.log