Apache mod_wsgi在FLASK中没有显示错误,但调用API显示404

时间:2017-08-17 04:26:37

标签: python apache mod-wsgi wsgi

虽然我可以在终端中使用python运行repo代码,所以我假设rest.py中没有问题

在运行apache时,一切似乎都在apache error.log中工作,甚至为flask-sqlalchemy生成警告,该警告应该在执行.wsgi代码后运行。

enter image description here

错误讯息:

enter image description here

我有什么遗失的吗? 文件及其相应的代码

HDR.conf

<VirtualHost *:4343>
            ServerName http://52.86.97.209/
            ServerAdmin swetabh.pathak@elucidata.io

            WSGIDaemonProcess app python-home=/home/ubuntu/.virtualenvs/venv  user=ubuntu group=ubuntu threads=5
            WSGIScriptAlias / /var/www/hdr_app/HDR.wsgi
            WSGIProcessGroup app
            WSGIApplicationGroup %{GLOBAL}
            <Directory /var/www/hdr_app>
            Require all granted
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/error.log
            LogLevel debug
            CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


<VirtualHost *:443>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

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

</VirtualHost>

HDR.wsgi

activate_this = '/home/ubuntu/.virtualenvs/HDR_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/hdr_app/")

from app import app as application

app.py

from flask_application import app

if __name__ == "__main__":
    app.run(host='0.0.0.0')

回购的目录结构:

hdr_app
|-- app.py
|-- app.pyc
|-- bower.json
|-- contributors.txt
|-- description
|-- flask_application
|   |-- admin
|   |   |-- controllers.py
|   |   `-- __init__.py
|   |-- config.py
|   |-- config.pyc
|   |-- constants.py
|   |-- constants.pyc
|   |-- controllers.py
|   |-- controllers.pyc
|   |-- filters.py
|   |-- filters.pyc
|   |-- helper.py
|   |-- helper.pyc
|   |-- __init__.py
|   |-- __init__.pyc
|   |-- logging_config.py
|   |-- logging_config.pyc
|   |-- public
|   |   |-- controllers.py
|   |   `-- __init__.py
|   |-- res.py
|   |-- rest.py
|   |-- rest.pyc
|   |-- script.py
|   |-- script.pyc
|-- gulpfile.config.js
|-- gulpfile.js
|-- HDR.wsgi
|-- __init__.py
|-- manage.py
|-- package.json
|-- README.md
|-- requirements.txt

0 个答案:

没有答案