我在 AWS EC2 Micro 实例上使用 Ubuntu 12.04.1,并尝试使用 uWSGI 和 nginx 设置简单的 Flask 应用程序。我在 uWSGI 配置方面遇到了一些奇怪的问题。
这是我的app.conf
:
[uwsgi]
socket = /tmp/tmp.sock
plugins = python27
chdir = /home/ubuntu/app
pythonpath = ..
module = app:app
virtualenv = /home/ubuntu/.virtualenvs/app
uWSGI 在重启后没有创建套接字文件,如果我用 手动运行它uwsgi -i /etc/uwsgi/apps-enabled/app.conf
,这里是日志:
*** Starting uWSGI 1.0.3-debian (64bit) on [Sat Mar 16 06:54:39 2013] ***
compiled with version: 4.6.3 on 17 July 2012 02:26:54
current working directory: /home/ubuntu/app
detected binary path: /usr/bin/uwsgi-core
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
The -s/--socket option is missing and stdin is not a socket.
但是当我添加-s
参数时,一切都正常:
uwsgi -i /etc/uwsgi/apps-enabled/app.conf -s /tmp/tmp.sock
*** Starting uWSGI 1.0.3-debian (64bit) on [Sat Mar 16 06:56:04 2013] ***
compiled with version: 4.6.3 on 17 July 2012 02:26:54
current working directory: /home/ubuntu/app
detected binary path: /usr/bin/uwsgi-core
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
uwsgi socket 0 bound to UNIX address /tmp/tmp.sock fd 3
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
spawned uWSGI worker 1 (and the only) (pid: 18023, cores: 1)
那么,似乎 uWSGI 忽略了socket
应用程序配置文件中设置的选项?
这种情况只发生在 ini 格式的配置文件中 - 使用 XML 编写的相同配置则一切正常。看起来像是一个错误。
答案1
uWSGI 仅期望一些扩展,例如.ini
,.xml
...
将文件重命名app.conf
为app.ini
将解决问题。