I am setting up a web server with gunicorn + django. There are two deployment options: either use regular WSGI, or use gunicorn's django-integration. I'm tempted to use the latter, because it simplifies configuration, but the django documentation says this:
If you are using Django 1.4 or newer, it’s highly recommended to simply run your
application with the WSGI interface using the gunicorn command as described above.
They give no explanation, so I wonder why it's "highly recommended" to go with WSGI? Any ideas?
Thanks a lot.
In order to deploy a Django project to the real world, you'll need to set it up to work on an WSGI/ASGI server. A WSGI/ASGI server is a piece of software designed to run Python applications in a web environment.
Gunicorn takes care of everything which happens in-between the web server and your web application. This way, when coding up your a Django application you don't need to find your own solutions for: communicating with multiple web servers. reacting to lots of web requests at once and distributing the load.
Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.
Gunicorn and uWSGI are primarily classified as "Web Servers" and "Web Server Interface" tools respectively. Gunicorn and uWSGI are both open source tools. Gunicorn with 5.96K GitHub stars and 1.12K forks on GitHub appears to be more popular than uWSGI with 2.5K GitHub stars and 541 GitHub forks.
Starting with Django 1.4, your project will already have a wsgi.py, which can be used with any wsgi server (of which there are many, gunicorn being just one).
Essentially the old Django integration for gunicorn was just a convenience to get you up and running faster, but it's no longer necessary because all Django projects now have wsgi.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With