2016-01-11 149 views
1

我正在嘗試使用uwsgi + supervisor + nginx運行Flask應用程序。在conda env使用supervisor和uwsgi問題

uwsgi安裝在康達ENV,我可以,如果我運行(與激活了我的暢達ENV)無主管沒有問題,運行我的應用程序,即:

uwsgi --ini /home/me/Development/flask/myflaskapp/myflaskapp.ini 

與以下配置:

/home/me/Development/flask/myflaskapp/myflaskapp.ini

[uwsgi] 
chmod-socket = 666 
socket = /home/me/Development/flask/myflaskapp/run/myflaskapp.sock 
module = wsgi 
callable = app 

的vim的/ etc/nginx的/位,AVA ilable/myflaskapp

server { 
    listen 8000; 
    server_name localhost; 
    client_max_body_size 50M; 

    location/{ 
     include uwsgi_params; 
     uwsgi_pass unix:/home/me/Development/flask/myflaskapp/run/myflaskapp.sock; 
    } 
} 

現在我創建一個主管的配置文件:

/etc/supervisor/conf.d/uwsgi-myflaskapp.conf

[program:uwsgi-myflaskapp] 
command=/home/me/Development/miniconda/envs/myflaskapp/bin/uwsgi /home/me/Development/flask/myflaskapp/myflaskapp.ini 
autostart=true 
autorestart=true 
stdout_logfile=/home/me/Development/flask/myflaskapp/log/uwsgi-myflaskapp.log 
redirect_stderr=true 
exitcodes=0 

我開始主管(安裝系統)

sudo service supervisor start 

和加載具有

sudo supervisorctl reload 

conf文件,但我得到了下面的錯誤日誌文件:

ImportError: No module named wsgi 

什麼建議嗎?

下面是完整的日誌:

[uWSGI] getting INI configuration from /home/me/Development/flask/myflaskapp/myflaskapp.ini 
*** Starting uWSGI 2.0.12 (64bit) on [Mon Jan 11 19:12:14 2016] *** 
compiled with version: 4.8.4 on 11 January 2016 10:54:59 
os: Linux-3.13.0-74-generiC#118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 
nodename: roquefort 
machine: x86_64 
clock source: unix 
pcre jit disabled 
detected number of CPU cores: 4 
current working directory:/
detected binary path: /home/me/Development/miniconda/envs/myflaskapp/bin/uwsgi 
uWSGI running as root, you can use --uid/--gid/--chroot options 
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager *** 
your processes number limit is 63047 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to UNIX address /home/me/Development/flask/myflaskapp/run/myflaskapp.sock fd 3 
Python version: 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:08:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] 
*** Python threads support is disabled. You can enable it with --enable-threads *** 
Python main interpreter initialized at 0x18001e0 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 72760 bytes (71 KB) for 1 cores 
*** Operational MODE: single process *** 
ImportError: No module named wsgi 
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 worker 1 (and the only) (pid: 24671, cores: 1) 

回答

0

chdir = /home/me/Development/flask/myflaskapp 

添加wsgi.py文件的路徑在/home/me/Development/flask/myflaskapp/myflaskapp.ini所以,它現在能夠找到的WSGI。

+0

如果你想指出一個基於這個問題出現的新問題,請在評論中這樣做,而不是作爲你答案的一部分。正如你所看到的,這使得答案看起來像一個新的問題,這是不允許在這個網站上。 – josliber