uWSGI无法加载Flask应用

时间:2017-05-02 16:11:52

标签: python flask uwsgi

我一直在讨论这个问题几天,我仍然遇到问题。我的uWSGI实例显然没有加载我的Flask应用程序。我正在运行CentOS 7 Vagrant并使用Ansible进行配置管理。我将发布最终的模板文件

我的文件设置如下

#/etc/tickets/tickets.ini
[uwsgi]
module = wsgi
master = true
processes = 4
socket = tickets.sock
chmod-socket = 664
uid = uwsgi
gid = nginx
vacuum = true
die-on-term = true
logto2 = /var/log/uwsgi/tickets.log

模块

#/opt/tickets/wsgi.py
import os

from create import create_app

app = create_app(os.getenv('APP_CONFIG') or 'default')

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

系统服务

#/etc/systemd/system/tickets.service
[Unit]
Description=uWSGI instance to serve tickets
After=network.target

[Service]
User=uwsgi
Group=nginx
WorkingDirectory=/opt/tickets
ExecStart=/usr/bin/uwsgi --ini /etc/tickets/tickets.ini

[Install]
WantedBy=multi-user.target

这是我的应用程序uwsgi log

[vagrant@tickets uwsgi]$ cat tickets.log 

*** Operational MODE: preforking ***
/usr/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:839: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14820)
spawned uWSGI worker 1 (pid: 14886, cores: 1)
spawned uWSGI worker 2 (pid: 14887, cores: 1)
spawned uWSGI worker 3 (pid: 14888, cores: 1)
spawned uWSGI worker 4 (pid: 14889, cores: 1)

我现在不知所措。我已经尝试将uwsgi的.ini移动到wysgi.py的目录中,但这也无效。 ticket.sock确实在/opt/tickets目录中创建。该服务正在运行,但它似乎没有加载应用程序。

修改

模仿此tutorial

0 个答案:

没有答案