Deploying Django/Flask App in Production with NGINX Unit and Docker
NGINX unit is a modern take at application server, it supports talking to apps over CGI, WSGI and shared memory incase of statically compiled apps. Unit is open source available at https://unit.nginx.org/
Here are some features:
- Modern Polyglot Application Server
- Supports advanced workflow like deploying apps without any downtime, remote configuration management via REST APIs and has ability to run multiple apps (even with different runtime versions!)
- Support for custom routing logic allows easy to A/B testing.
- And it can do TLS in case you’re looking for end-to-end TLS encryption.
Does that sound exciting? let’s look at how you can use Unit to deploy your Django or Flask app on production environment.
Steps for Flask App (we’ll use existing httpbin app which is written using Flask framework and uses gunicorn as application server):