uWSGI无法加载Flask应用程序

2024-04-19 04:03:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经在这上面闲逛了几天了,我仍然有问题。我的uWSGI实例显然没有加载我的Flask应用程序。我正在运行一个CentOS 7流浪者并使用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

模块

^{pr2}$

系统服务

#/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日志

[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。在


Tags: 文件toinlogtrue应用程序etcpid