4 ms·
For the python web folks, what web server do you tend to put in front of your Django/Flask apps and how do you typically deploy new updates with zero downtime?
by smaili 9y ago
For the python web folks, what web server do you tend to put in front of your Django/Flask apps and how do you typically deploy new updates with zero downtime?
- mvid 9y agoNginx is the one I see the most these days. Having multiple instances behind a reverse proxy allows you to do rolling deploys, which will have no downtime.
- jldugger 9y agoI currently use Apache with mod_wsgi. New updates involve just touching the .wsgi file. schema changes are a bit more involved obviously.
- brianwawok 9y agoFor a while I did nginx with gunicorn. No downtime rolling deploys. Just need a git pull and the proper kill signal. Now I use kubernetes with uwsgi. Once you are kubernetes any app server works, so went uwsgi because it is very very simple.
- mundanevoice 9y agoNginx + Gunicorn is what we use. It has worked great for us. We have also tried uWSGI, a waitress for our production and Nginx + Gunicorn have been sure shot winners in terms of scalability and performance. This is our gunicorn.conf that ensures gunicorn does not cause memory leaks import multiprocessing import os import random from getenv import env def pre_fork(server, worker): f = '/tmp/app-initialized' open(f, 'w').close() bind = 'unix:///tmp/nginx.socket' workers = os.environ.get('WEB_CONCURRENCY', (multiprocessing.cpu_count() * 1 - 1)) MAX_GUNICORN_REQUESTS = env('MAX_GUNICORN_REQUESTS', 100) if MAX_GUNICORN_REQUESTS: max_requests = MAX_GUNICORN_REQUESTS MAX_REQUESTS_JITTER = env('MAX_REQUESTS_JITTER', 25) if MAX_REQUESTS_JITTER: max_requests_jitter = env('MAX_REQUESTS_JITTER', 25)