Flask Apache mod_wsgi 无尽的页面加载

Flask Apache mod_wsgi Endless page loading

我有 /etc/apache2/sites-available/SpinnerApp.conf

<VirtualHost *:80>
            ServerName 95.xxx.xxx.xx
            ServerAlias domain.ru

            WSGIScriptAlias / /var/www/SpinnerApp/spinnerapp.wsgi
            WSGIDaemonProcess SpinnerApp user=www-data group=www-data threads=5

            <Directory /var/www/SpinnerApp/SpinnerApp/>
                    WSGIProcessGroup SpinnerApp
                    WSGIApplicationGroup %{GLOBAL}
                    WSGIScriptReloading On
                    Order allow,deny
                    Allow from all
            </Directory>

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

和/var/www/SpinnerApp/spinnerapp.wsgi

#!/usr/bin/python
import os, sys, logging
logging.basicConfig(stream=sys.stderr)

activate_this = os.path.join('/var/www/SpinnerApp/SpinnerApp/spinnerenv', 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))

sys.path.insert(0,'/var/www/SpinnerApp')

from SpinnerApp import app as application

但是在浏览器页面中输入ip时加载不完。 Apache 日志中没有错误。

求求你帮忙

这是错误的:

<Directory /var/www/SpinnerApp/SpinnerApp/>

应该是:

<Directory /var/www/SpinnerApp>

它完全有效表明您的整体 Apache 配置可能被搞砸了,因为访问控制根本不允许使用该位置的 WSGI 脚本,这是错误的。

此错误的其他含义是代码 运行 处于嵌入式模式,这不是首选安排。也就是说,没有使用创建的守护进程组。此外,并未暗示 WSGIApplicationGroup 指令。这个特定的是为什么你可能会看到你所做的问题。也就是说,您使用的是第三方 Python 模块,该模块在 Python 子解释器中无法正常工作。该指令避免使用子解释器。

此外,ServerName 指令值不应是 IP 地址,而应是主机名。将其设置为您用于 ServerAlias 的值,然后删除 ServerAlias 指令行。