Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use django-gunicorn integration or wsgi?

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.

like image 896
MiniQuark Avatar asked Mar 13 '13 08:03

MiniQuark


People also ask

Does Django need WSGI?

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.

Is Gunicorn needed for Django?

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.

What is Gunicorn and WSGI?

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.

Which is better uWSGI or Gunicorn?

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.


1 Answers

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

like image 199
Andrew Ingram Avatar answered Oct 10 '22 02:10

Andrew Ingram