mod_wsgi没有运行,但是Apache日志中没有错误

时间:2019-02-14 23:11:02

标签: python apache mod-wsgi

经过数小时的搜索以消除我遇到的错误之后,对本教程(https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps)进行了一些修改。我以为我终于可以正常工作了,因为我没有收到错误,但是当我点击我的API URL时,我得到了ERR_CONNECTION_REFUSED。

如果我在venv中运行 init .py文件,则可以访问该API并可以正常工作,但是当我重新启动apapa程序时,它什么也没做,并看着错误日志,我什么也看不到:

[Thu Feb 14 22:47:13.860116 2019] [mpm_event:notice] [pid 80796:tid 139748346596288] AH00491: caught SIGTERM, shutting down
[Thu Feb 14 22:47:33.959485 2019] [mpm_event:notice] [pid 80941:tid 140708785982400] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured -- resuming normal operations
[Thu Feb 14 22:47:33.959818 2019] [core:notice] [pid 80941:tid 140708785982400] AH00094: Command line: '/usr/sbin/apache2'

/var/www/FlaskApp/flaskapp.wsgi

#!/usr/bin/python
activate_this = '/var/www/FlaskApp/FlaskApp/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApp/")
sys.path.append('/home/dtadmin/.local/lib/python2.7/site-packages')

from FlaskApp import app as application
application.secret_key = 'secretKeyHere'

/etc/apache2/sites-enabled/FlaskApp.conf

<VirtualHost *:5000>


        ServerName 10.x.x.x
        ServerAdmin email@address.com

       WSGIDaemonProcess /var/www/FlaskApp/FlaskApp/venv/lib/python2.7/site-packages:$

        WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi

        <Directory /var/www/FlaskApp/FlaskApp/>
                Order allow,deny
                Allow from all
        </Directory>

        Alias /static /var/www/FlaskApp/FlaskApp/static
        <Directory /var/www/FlaskApp/FlaskApp/static/>
                Order allow,deny
                Allow from all
        </Directory>


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

</VirtualHost>

init .py位于

/var/www/FlaskApp/FlaskApp/__init__.py

0 个答案:

没有答案