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
Copy file name to clipboardExpand all lines: docs/scenarios/web.rst
+15-93Lines changed: 15 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,48 +71,16 @@ you may need, such as database access or form generation and validation. For
71
71
many popular modules, `Extensions <http://flask.pocoo.org/extensions/>`_ may
72
72
already exist to suit your needs.
73
73
74
-
**Support** for flask can best be found in its mailing list. Just shoot an email to
74
+
**Support** for flask can best be found in its mailing list. Just shoot an email to
75
75
flask@librelist.com and reply to the confirmation email.
76
76
77
77
78
-
Pyramid
79
-
-------
80
-
81
78
.. todo:: Explain Pyramid
82
79
83
-
Web.py
84
-
------
85
-
86
-
`web.py <http://webpy.org>`_ is a minimalist web framework that is somewhere between Django and Flask.
87
-
The premise of web.py is that it is flexible - code your webapp any way you want it, in just python and python alone.
88
-
web.py comes with some nifty tools built in, like database connection tools and a mini http server.
89
-
90
-
**Support** for web.py is quite sparse, but you can look for support in the `mailing list <http://groups.google.com/group/webpy>`_ .
91
-
92
80
93
81
Web Servers
94
82
:::::::::::
95
83
96
-
Apache
97
-
------
98
-
99
-
mod_python
100
-
~~~~~~~~~~
101
-
102
-
For a long period Apache with mod_python was one of the most reccomended
103
-
ways to deploy Python applications and thus you may see many tutorials
104
-
about it on the web or in books, however Apache no longer supports
105
-
mod_python [1]_ and thus this deployment mechanism is strongly discouraged in
106
-
favor of WSGI based ones.
107
-
108
-
mod_wsgi
109
-
~~~~~~~~
110
-
111
-
Many improvements have been made with mod_wsgi over mod_python for serving
112
-
Python with Apache [2]_. If you must run the Apache web server, mod_wsgi is
113
-
your best option for running Python, other than proxying to a dedicated WSGI
114
-
server.
115
-
116
84
.. _nginx-ref:
117
85
118
86
Nginx
@@ -125,82 +93,41 @@ application servers (like WSGI servers). It also includes handy features
125
93
like load-balancing, basic authentication, streaming, and others. Designed
126
94
to serve high-load websites, Nginx is gradually becoming quite popular.
127
95
128
-
Mongrel2
129
-
--------
130
-
131
-
`Mongrel2 <http://mongrel2.org>`_ is an application, language, and network
132
-
architecture agnostic web server. It uses a high performance queue (zeromq) to
133
-
communicate with your applications, all asynchronously. There is a well defined
134
-
protocol to be used between mongrel2 and a backend handler (your app).
135
-
136
-
Brubeck
137
-
~~~~~~~
138
-
139
-
.. todo:: Explain Mongrel2 + Brubeck
140
-
141
-
wsgid
142
-
~~~~~
143
-
144
-
`Wsgid <http://wsgid.com>`_ is a generic mongrel2 handler that speaks both
145
-
mongrel2 protocol and WSGI. This makes it possible to run your python webapp
146
-
written with any WSGI compliant framework. Wsgid has built-in Django support but
147
-
has also a generic way to load your WSGI application object directly. It's
148
-
possible to add support for other frameworks through wsgid's pluggable
149
-
Apploading interface.
150
-
151
-
.. rubric:: Resources
152
-
153
-
* `Deploying your django application with mongrel2 and wsgid <http://daltonmatos.wordpress.com/2011/11/06/deploying-your-django-application-with-mongrel2-and-wsgid/>`_
154
96
155
97
.. _wsgi-servers-ref:
156
98
157
99
WSGI Servers
158
100
::::::::::::
159
101
160
-
Stand-alone WSGI servers typically use less resources than traditional web
102
+
Stand-alone WSGI servers typically use less resources than traditional web
161
103
servers and provide top performance [3]_.
162
104
163
105
.. _gunicorn-ref:
164
106
165
-
gUnicorn
107
+
Gunicorn
166
108
--------
167
109
168
-
`gUnicorn<http://gunicorn.org/>`_ (Green Unicorn) is a WSGI server used
169
-
to serve Python applications. It is a Python fork of the Ruby
170
-
`Unicorn <http://unicorn.bogomips.org/>`_ server. gUnicorn is designed to be
171
-
lightweight, easy to use, and uses many UNIX idioms. gUnicorn is not designed
110
+
`Gunicorn<http://gunicorn.org/>`_ (Green Unicorn) is a WSGI server used
111
+
to serve Python applications. It is a Python interpretation of the Ruby
112
+
`Unicorn <http://unicorn.bogomips.org/>`_ server. Unicorn is designed to be
113
+
lightweight, easy to use, and uses many UNIX idioms. Gunicorn is not designed
172
114
to face the internet, in fact it was designed to run behind Nginx which buffers
173
115
slow requests, and takes care of other important considerations. A sample
174
116
setup for Nginx + gUnicorn can be found in the
175
-
`gUnicorn help <http://gunicorn.org/deploy.html>`_.
117
+
`Gunicorn help <http://gunicorn.org/deploy.html>`_.
176
118
177
119
.. _uwsgi-ref:
178
120
179
-
uwsgi
180
-
-----
181
-
182
-
`uWSGI <http://projects.unbit.it/uwsgi/>`_ is a fast, self-healing and
183
-
developer/sysadmin-friendly application container server coded in pure C.
184
-
185
-
Born as a WSGI-only server, over time it has evolved in a complete stack for
186
-
networked/clustered web applications, implementing message/object passing,
187
-
caching, RPC and process management.
188
121
189
122
Server Best Practices
190
123
:::::::::::::::::::::
191
124
192
-
While Apache will serve your Python application, and many references suggest it,
193
-
modern best practices suggest against it. With the improvements in mod_wsgi over
194
-
mod_python, Apache can handle many more requests than before. However, mod_wsgi
195
-
tends to use more memory than other WSGI solutions [3]_.
196
-
197
125
The majority of self hosted Python applications today are hosted with a WSGI
198
-
server such as :ref:`uWSGI <uwsgi-ref>` or :ref:`gUnicorn <gunicorn-ref>` behind a
199
-
lightweight web server such as :ref:`nginx <nginx-ref>` or
200
-
`lighttpd <http://www.lighttpd.net/>`_.
126
+
server such as :ref:`gUnicorn <gunicorn-ref>`, either directly or behind a
127
+
lightweight web server such as :ref:`nginx <nginx-ref>`.
201
128
202
129
The WSGI servers serve the Python applications while the web server handles tasks
203
-
better suited for it such as static file serving, request routing, DDoS
130
+
better suited for it such as static file serving, request routing, DDoS
204
131
protection, and basic authentication.
205
132
206
133
Hosting
@@ -305,19 +232,14 @@ WebFaction
305
232
306
233
`Webfaction <http://www.webfaction.com/>`_ started off as a dedicated python hosting company.
307
234
In fact it used to be called python-hosting.com. Webfaction supports Python versions 2.4 through to 2.7.2
308
-
as well as Python 3 versions.
235
+
as well as Python 3 versions.
309
236
310
-
Webfaction has a very extensive `user guide <http://docs.webfaction.com/user-guide/>`_
311
-
and specific stack (`Django <http://docs.webfaction.com/software/django/index.html>`_, `Pylons <http://docs.webfaction.com/software/pylons.html>`_,
0 commit comments