|
76 | 76 | <h1>WSGI Servers</h1> |
77 | 77 | <p>A <a href="http://wsgi.readthedocs.org/en/latest/">Web Server Gateway Interface</a> |
78 | 78 | (WSGI) server implements the web server side of the WSGI interface for |
79 | | -running Python web applications. The WSGI standard v1.0 is specified in |
| 79 | +running Python web applications. </p> |
| 80 | +<h2>Why are WSGI servers necessary?</h2> |
| 81 | +<p>A traditional web server does not understand or have any way to execute Python |
| 82 | +code. In the late 1990s, a developer named Grisha Trubetskoy |
| 83 | +<a href="http://grisha.org/blog/2013/10/25/mod-python-the-long-story/">came up with an Apache module called mod_python</a> |
| 84 | +to execute Python code. For several years in the late 1990s and early 2000s, |
| 85 | +Apache configured with mod_python ran most of the Python web applications |
| 86 | +on the web.</p> |
| 87 | +<p>However, mod_python wasn't a standard. It was just an implementation that |
| 88 | +allowed arbitrary Python code to run on a server. As mod_python's |
| 89 | +development stalled and security vulnerabilities were discovered there |
| 90 | +was recognition by the community that a consistent way to execute Python |
| 91 | +code for web applications was needed.</p> |
| 92 | +<p>Therefore the Python community came up with WSGI as a standard interface that<br /> |
| 93 | +modules and containers could implement to run Python applications. WSGI is |
| 94 | +now the accepted approach for running Python web application code. </p> |
| 95 | +<h2>PEP specification</h2> |
| 96 | +<p>The WSGI standard v1.0 is specified in |
80 | 97 | <a href="http://www.python.org/dev/peps/pep-0333/">PEP 0333</a>. As of September 2010, |
81 | 98 | WSGI v1.0 is superseded by |
82 | 99 | <a href="http://www.python.org/dev/peps/pep-3333/">PEP 3333</a>, which defines the |
83 | 100 | v1.0.1 WSGI standard.</p> |
84 | 101 | <p><img src="theme/img/web-browser-server-wsgi.png" alt="WSGI Server <-> Web server <-> Browser" width="100%" class="technical-diagram" /></p> |
| 102 | +<h2>Example configuration</h2> |
85 | 103 | <p>A web server's configuration specifies what requests should be passed to |
86 | 104 | the WSGI server to process. Once a request is processed and generated by the |
87 | 105 | WSGI server, the response is passed back through the web server and onto |
@@ -201,6 +219,12 @@ <h2>WSGI Resources</h2> |
201 | 219 | <a href="http://bartek.im/blog/2012/07/08/simplicity-nginx-uwsgi-deployment.html">The Beautiful Simplicity of an nginx and uWSGI Deployments</a> |
202 | 220 | is great reading for understanding Nginx and uWSGI configurations.</p> |
203 | 221 | </li> |
| 222 | +<li> |
| 223 | +<p>The Python community made a long effort to |
| 224 | + <a href="http://blog.dscpl.com.au/2010/05/modpython-project-soon-to-be-officially.html">transition from mod_python</a> |
| 225 | + to the WSGI standard. That transition period is now complete and an |
| 226 | + implementation of WSGI should always be used instead mod_python.</p> |
| 227 | +</li> |
204 | 228 | </ul> |
205 | 229 | <br/> |
206 | 230 | Next read the |
|
0 commit comments