我创建了一个小型python应用程序,通过setuptools(setup.py和setup()方法)将其安装到我的系统中。
在python中,我可以做到以下几点:
>>> import fms.server_api
>>> dir (fms.server_api)
['BaseFMSException', 'Flask', 'InnerServerError', 'LOG', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'app', 'handlers', 'json_utils', 'log_utils', 'logging', 'request', 'safe_handle', 'search_albums', 'search_artist', 'search_songs', 'test']
其中app是我的Flask应用程序。
这是我的uwsgi的配置:
[uwsgi]
socket = /var/tmp/fms_flask.sock
module = fms.server_api:app
master =true
processes = 1
threads = 2
有什么问题?问题是我无法运行uwsgi作为 sudo service uwsgi restart :
登录:
[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini
[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/fms_flask.ini
Mon Dec 16 05:32:46 2013 - *** Starting uWSGI 1.0.3-debian (32bit) on [Mon Dec 16 05:32:46 2013] ***
Mon Dec 16 05:32:46 2013 - compiled with version: 4.6.3 on 17 July 2012 02:24:04
Mon Dec 16 05:32:46 2013 - current working directory: /
Mon Dec 16 05:32:46 2013 - writing pidfile to /run/uwsgi/app/fms_flask/pid
Mon Dec 16 05:32:46 2013 - detected binary path: /usr/bin/uwsgi-core
Mon Dec 16 05:32:46 2013 - setgid() to 33
Mon Dec 16 05:32:46 2013 - setuid() to 33
Mon Dec 16 05:32:46 2013 - your memory page size is 4096 bytes
Mon Dec 16 05:32:46 2013 - allocated 1296 bytes (1 KB) for 2 cores per worker.
Mon Dec 16 05:32:46 2013 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/fms_flask/socket fd 5
Mon Dec 16 05:32:46 2013 - uwsgi socket 1 bound to UNIX address /var/tmp/fms_flask.sock fd 6
Mon Dec 16 05:32:46 2013 - your server socket listen backlog is limited to 100 connections
Mon Dec 16 05:32:46 2013 - *** Operational MODE: threaded ***
Mon Dec 16 05:32:46 2013 - *** no app loaded. going in full dynamic mode ***
Mon Dec 16 05:32:46 2013 - *** uWSGI is running in multiple interpreter mode ***
Mon Dec 16 05:32:46 2013 - spawned uWSGI master process (pid: 31994)
Mon Dec 16 05:32:46 2013 - spawned uWSGI worker 1 (pid: 31996, cores: 2)
Mon Dec 16 05:34:05 2013 - -- unavailable modifier requested: 0 --
Mon Dec 16 05:34:05 2013 - -- unavailable modifier requested: 0 --
但如果我使用 sudo uwsgi --ini /etc/uwsgi/apps-enabled/fms_flask.ini
,完美无缺问题出在哪里?