From c8207819c8cc56ab624bb8303c01cc8cf82b4daf Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 22 Feb 2016 00:16:35 -0500 Subject: [PATCH] update to web --- docs/scenarios/web.rst | 111 ++++++++++++----------------------------- 1 file changed, 31 insertions(+), 80 deletions(-) diff --git a/docs/scenarios/web.rst b/docs/scenarios/web.rst index fea1094..8aeea87 100644 --- a/docs/scenarios/web.rst +++ b/docs/scenarios/web.rst @@ -61,6 +61,7 @@ project as-is, or customized to fit your needs. There are annual Django conferences `in the United States `_ and `in Europe `_. +The majority of new Python web applications today are built with Django. Flask ----- @@ -84,61 +85,29 @@ For those that do, there are many `Extensions `_ available that may suit your needs. Or, you can easily use any library you want yourself! - -Web.py ------- -`Web.py `_ is a web framework for Python that is as -simple as it is powerful. You won't find wizards or boilerplate websites -in Web.py and will have to build from scratch. Web.py provides no administration -utility. Web.py is the brainchild of Aaron Swartz, who developed it while working -on Reddit.com. - - -Web2py ------- -A full stack web framework and platform focused in the ease of use. It focuses on -rapid development, favors convention over configuration approach and follows a -model–view–controller (MVC) architectural pattern. - - -Werkzeug --------- - -`Werkzeug `_ is not actually a real framework, but -rather a very powerful set of tools for building web applications. It provides -URL routing utilities, request and response objects and a basic development -server. It is mostly used where users need more flexibility for their -application than is commonly found in other web frameworks. - -Support can be found on its `mailing list `_. +Flask is default choice for any Python web application that isn't a good +fit for Django. Tornado -------- -`Tornado `_ is a scalable, non-blocking web server -and web application framework with a relative simple usage. Tornado is known -for its high performance. It was initially developed for -`friendfeed `_ , a real time chat and blog system. - -In the Jinja2 template engine example it is used to serve the rendered pages. +`Tornado `_ is an asyncronous web framework +for Python that has its own event loop. This allows it to natively support +WebSockets, for example. Well-written Tornado applications are known to +have excellent performance charecteristics. Pyramid -------- -`Pyramid `_ lies somewhere between a big -framework like Django and the microframeworks: It comes with a lot of libraries -and functionality and can thus not be considered lightweight. On the other -hand, it does not provide all the functionality Django does. Instead Pyramid -brings basic support for most regular tasks and provides a great deal of -extensibility. Additionally, Pyramid has a huge focus on complete -`documentation `__. -As a little extra it comes with the Werkzeug Debugger which allows you to debug -a running web application in the browser. - -**Support** can also be found in the -`documentation `__. +`Pyramid `_ is a lot like Django, except +with a heavier focus on modularity. It comes with a smaller number of +libraries ("batteries") built-in, and encourages users to extend its +base functionality. +Pyramid does not have a large user base, ulike Django and Flask (or even +Tornado). It's a capable framework, but not a very popular choice for +new Python web applications today. Web Servers ::::::::::: @@ -169,14 +138,16 @@ servers and provide top performance [3]_. Gunicorn -------- -`Gunicorn `_ (Green Unicorn) is a WSGI server used -to serve Python applications. It is a Python interpretation of the Ruby -`Unicorn `_ server. Unicorn is designed to be -lightweight, easy to use, and uses many UNIX idioms. Gunicorn is not designed -to face the internet -- it was designed to run behind Nginx which buffers -slow requests and takes care of other important considerations. A sample -setup for Nginx + Gunicorn can be found in the -`Gunicorn help `_. +`Gunicorn `_ (Green Unicorn) is a pure-python WSGI +server used to serve Python applications. Unlike other Python web servers, +it has a thoughtful user-interface, and is extremely easy to use and +configure. + +Gunicorn has sane and reasonable defaults for configurations. However, some +other servers, like uWSGI, are tremendously more customizable, and therefore, +are much more difficult to effectively user. + +Gunicorn is the default choice for new Python web applications today. .. _uwsgi-ref: @@ -196,6 +167,7 @@ Python, passing environment variables and further tuning. For full details, see `uWSGI magic variables `_. +I do not recommend usign uWSGI unless you think you need to. .. _server-best-practices-ref: @@ -235,40 +207,19 @@ logging, scheduled and background tasks, billing and payment, etc. Heroku ~~~~~~ -`Heroku `_'s -`Cedar stack `_ offers first class -support for Python 2.7 applications. +`Heroku `_ offers first-class support for +Python 2.7–3.5 applications. -Heroku allows you to run as many Python web applications as you like, 24/7 and -free of charge. Heroku is best described as a horizontal scaling platform. They -start to charge you once you "scale" your application to run on more than one -Dyno (abstracted servers) at a time. +Heroku allows you to run Python web applications free of charge. It is best +described as a horizontal scaling platform. They start to charge you once you +"scale" your application to run in production. Hobby pricing is available. Heroku maintains `articles `_ on using Python with Heroku as well as `step-by-step instructions `_ on how to set up your first application. - -DotCloud -~~~~~~~~ - -`DotCloud `_ supports WSGI applications and -background/worker tasks natively on their platform. Web applications run -Python version 2.6, use :ref:`nginx ` and :ref:`uWSGI -`, and allow custom configuration of both for advanced users. - -DotCloud uses a custom command-line API client which can work with -applications managed in git repositories or any other version control -system. - -DotCloud has a free plan with limited database size, and without extra -services (caching…). - -See the `DotCloud documentation on Python -`_ for more information and help -getting started. - +Heroku is the recommended PaaS for deploying Python web applications today. Gondor ~~~~~~