python - Deploy flask in production with GeventWSGI and Nginx -


i have rest api written in python flask , flaskrestful extension. use gevent wsgi

def runserver(): api.debug = true http_server = wsgiserver(('', 5000), api) http_server.start() 

all works charm on machine. want go in production on linux vm,on internet searched hours,i don't choosed mod_wsgi because gevent doesn't work it,so prefer use nginx.

on internet saw flask apps hosted uwsgi,my answer need use uwsgi? use geventwsgi in flask application? how work this? in case don't need uwsgi,i need config nginx sites pass request flask app? i'm newbie i'm little confused.

thanks in advance

you can run uwsgi in gevent mode http://uwsgi-docs.readthedocs.org/en/latest/gevent.html , route flask requests via nginx.

       server {           listen 80;           server_name customersite1.com;           access_log /var/log/customersite1/access_log;           location / {           root /var/www/customersite1;           uwsgi_pass 127.0.0.1:3031;           include uwsgi_params;           } 

see http://uwsgi-docs.readthedocs.org/en/latest/nginx.html more details


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -