You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as an example Django project. Within the <ahref="https://github.com/makaimc/compare-python-web-frameworks/tree/master/django_defaults/django_defaults">django_defaults</a>
8236
+
project subdirectory, there is a short <ahref="https://github.com/makaimc/compare-python-web-frameworks/blob/master/django_defaults/django_defaults/wsgi.py">wsgi.py</a>
<p>That <code>wsgi.py</code> file was generated by the <code>django-admin.py startproject</code> command
8258
+
when the Django project was first created. Django exposes an <code>application</code>
8259
+
variable via that <code>wsgi.py</code> file so that a WSGI server can use <code>application</code>
8260
+
as a hook for running the web app. Here's how the situation looks visually:</p>
8261
+
<p><imgsrc="/img/gunicorn-django-wsgi.png" alt="Gunicorn WSGI server invoking a Django WSGI application." width="100%" class="technical-diagram" /></p>
8262
+
<h2>What's a "pre-fork" worker model?</h2>
8263
+
<p>Gunicorn is based on a pre-fork worker model, compared to a worker model
8264
+
architecture. The pre-work worker model means that a master thread spins up
8265
+
workers to handle requests but otherwise does not control how those workers
8266
+
perform the request handling. Each worker is independent of the controller.</p>
8267
+
<h3>Gunicorn resources</h3>
8268
+
<ul>
8269
+
<li>
8270
+
<p><ahref="http://adambeagle.com/blog/deploying-django-17-ubuntu/">Deploying Django 1.7 on Ubuntu with DigitalOcean with PostgreSQL, Nginx, and Gunicorn</a>
8271
+
is a detailed walkthrough that uses Green Unicorn as the WSGI server part of
8272
+
the deployment.</p>
8273
+
</li>
8274
+
<li>
8275
+
<p>The <ahref="http://www.deploypython.com/">Full Stack Python Guide to Deployments</a>
8276
+
provides detailed step-by-step instructions for deploying Gunicorn as part
8277
+
of an entire Python web application deployment.</p>
8278
+
</li>
8279
+
<li>
8280
+
<p><ahref="http://prakhar.me/articles/flask-on-nginx-and-gunicorn/">Flask on Nginx and Gunicorn</a>
8281
+
combines the <ahref="/nginx.html">Nginx web server</a> with Gunicorn in a deployment
8282
+
to serve up a Flask application.</p>
8283
+
</li>
8284
+
<li>
8285
+
<p>The answers to the question "<ahref="http://stackoverflow.com/questions/16857955/running-django-with-gunicorn-best-practice">what's the best practice for running Django with Gunicorn?</a>"
8286
+
provide some nuance for how Gunicorn should be invokin the callable application
8287
+
variable provided by Django within a deployment.</p>
8288
+
</li>
8289
+
<li>
8290
+
<p><ahref="http://linoxide.com/linux-how-to/install-django-gunicorn-nginx-freebsd-10-2/">How to Install Django with Gunicorn and Nginx on FreeBSD 10.2</a>
8291
+
is a tutorial for FreeBSD, which is not often used in walkthroughs compared to
8292
+
the frequency that Ubuntu and CentOS tutorials appear.</p>
8293
+
</li>
8210
8294
</ul>
8211
8295
<h1>Testing</h1>
8212
8296
<p>Testing determines whether software runs correctly based on specific inputs
0 commit comments