|
1 | 1 | Overview
|
2 |
| --------- |
| 2 | +======== |
3 | 3 |
|
4 |
| -`FriendFeed <http://friendfeed.com/>`_'s web server is a relatively |
| 4 | +`FriendFeed's <http://friendfeed.com/>`_ web server is a relatively |
5 | 5 | simple, non-blocking web server written in Python. The FriendFeed
|
6 | 6 | application is written using a web framework that looks a bit like
|
7 | 7 | `web.py <http://webpy.org/>`_ or Google's
|
@@ -144,48 +144,38 @@ Ubuntu Linux (Python 2.5)
|
144 | 144 | Module index
|
145 | 145 | ------------
|
146 | 146 |
|
147 |
| -The most important module is |
148 |
| -```web`` <http://github.com/facebook/tornado/blob/master/tornado/web.py>`_, |
| 147 | +The most important module is `tornado.web` |
149 | 148 | which is the web framework that includes most of the meat of the Tornado
|
150 |
| -package. The other modules are tools that make ``web`` more useful. See |
| 149 | +package. The other modules are tools that make `tornado.web` more useful. See |
151 | 150 | `Tornado walkthrough <#tornado-walkthrough>`_ below for a detailed
|
152 |
| -walkthrough of the ``web`` package. |
| 151 | +walkthrough of the `~tornado.web` package. |
153 | 152 |
|
154 | 153 | Main modules
|
155 | 154 | ~~~~~~~~~~~~
|
156 | 155 |
|
157 |
| -- ```web`` <http://github.com/facebook/tornado/blob/master/tornado/web.py>`_ |
158 |
| - - The web framework on which FriendFeed is built. ``web`` |
| 156 | +- `tornado.web` - The web framework on which FriendFeed is built. `web` |
159 | 157 | incorporates most of the important features of Tornado
|
160 |
| -- ```escape`` <http://github.com/facebook/tornado/blob/master/tornado/escape.py>`_ |
161 |
| - - XHTML, JSON, and URL encoding/decoding methods |
162 |
| -- ```database`` <http://github.com/facebook/tornado/blob/master/tornado/database.py>`_ |
163 |
| - - A simple wrapper around ``MySQLdb`` to make MySQL easier to use |
164 |
| -- ```template`` <http://github.com/facebook/tornado/blob/master/tornado/template.py>`_ |
165 |
| - - A Python-based web templating language |
166 |
| -- ```httpclient`` <http://github.com/facebook/tornado/blob/master/tornado/httpclient.py>`_ |
167 |
| - - A non-blocking HTTP client designed to work with ``web`` and |
168 |
| - ``httpserver`` |
169 |
| -- ```auth`` <http://github.com/facebook/tornado/blob/master/tornado/auth.py>`_ |
170 |
| - - Implementation of third party authentication and authorization |
171 |
| - schemes (Google OpenID/OAuth, Facebook Platform, Yahoo BBAuth, |
| 158 | +- `tornado.escape` - XHTML, JSON, and URL encoding/decoding methods |
| 159 | +- `tornado.database` - A simple wrapper around ``MySQLdb`` to make MySQL |
| 160 | + easier to use |
| 161 | +- `tornado.template` - A Python-based web templating language |
| 162 | +- `tornado.httpclient` - A non-blocking HTTP client designed to work |
| 163 | + with ``web`` and ``httpserver`` |
| 164 | +- `tornado.auth` - Implementation of third party authentication and |
| 165 | + authorization schemes (Google OpenID/OAuth, Facebook Platform, Yahoo BBAuth, |
172 | 166 | FriendFeed OpenID/OAuth, Twitter OAuth)
|
173 |
| -- ```locale`` <http://github.com/facebook/tornado/blob/master/tornado/locale.py>`_ |
174 |
| - - Localization/translation support |
175 |
| -- ```options`` <http://github.com/facebook/tornado/blob/master/tornado/options.py>`_ |
176 |
| - - Command line and config file parsing, optimized for server |
177 |
| - environments |
| 167 | +- `tornado.locale` - Localization/translation support |
| 168 | +- `tornado.options` - Command line and config file parsing, optimized for |
| 169 | + server environments |
178 | 170 |
|
179 | 171 | Low-level modules
|
180 | 172 | ~~~~~~~~~~~~~~~~~
|
181 | 173 |
|
182 |
| -- ```httpserver`` <http://github.com/facebook/tornado/blob/master/tornado/httpserver.py>`_ |
183 |
| - - A very simple HTTP server built on which ``web`` is built |
184 |
| -- ```iostream`` <http://github.com/facebook/tornado/blob/master/tornado/iostream.py>`_ |
185 |
| - - A simple wrapper around non-blocking sockets to aide common reading |
186 |
| - and writing patterns |
187 |
| -- ```ioloop`` <http://github.com/facebook/tornado/blob/master/tornado/ioloop.py>`_ |
188 |
| - - Core I/O loop |
| 174 | +- `tornado.httpserver` - A very simple HTTP server built on which ``web`` is |
| 175 | + built |
| 176 | +- `tornado.iostream` - A simple wrapper around non-blocking sockets to aide |
| 177 | + common reading and writing patterns |
| 178 | +- `tornado.ioloop` - Core I/O loop |
189 | 179 |
|
190 | 180 | Tornado walkthrough
|
191 | 181 | -------------------
|
@@ -369,8 +359,7 @@ Templates
|
369 | 359 | You can use any template language supported by Python, but Tornado ships
|
370 | 360 | with its own templating language that is a lot faster and more flexible
|
371 | 361 | than many of the most popular templating systems out there. See the
|
372 |
| -```template`` <http://github.com/facebook/tornado/blob/master/tornado/template.py>`_ |
373 |
| -module documentation for complete documentation. |
| 362 | +`tornado.template` module documentation for complete documentation. |
374 | 363 |
|
375 | 364 | A Tornado template is just HTML (or any other text-based format) with
|
376 | 365 | Python control sequences and expressions embedded within the markup:
|
@@ -409,8 +398,7 @@ Control statements more or less map exactly to Python statements. We
|
409 | 398 | support ``if``, ``for``, ``while``, and ``try``, all of which are
|
410 | 399 | terminated with ``{% end %}``. We also support *template inheritance*
|
411 | 400 | using the ``extends`` and ``block`` statements, which are described in
|
412 |
| -detail in the documentation for the ```template`` |
413 |
| -module <http://github.com/facebook/tornado/blob/master/tornado/template.py>`_. |
| 401 | +detail in the documentation for the `tornado.template`. |
414 | 402 |
|
415 | 403 | Expressions can be any Python expression, including function calls.
|
416 | 404 | Template code is executed in a namespace that includes the following
|
@@ -440,8 +428,7 @@ these entries are not present).
|
440 | 428 |
|
441 | 429 | When you are building a real application, you are going to want to use
|
442 | 430 | all of the features of Tornado templates, especially template
|
443 |
| -inheritance. Read all about those features in the ```template`` |
444 |
| -module <http://github.com/facebook/tornado/blob/master/tornado/template.py>`_ |
| 431 | +inheritance. Read all about those features in the `tornado.template` |
445 | 432 | section (some features, including ``UIModules`` are implemented in the
|
446 | 433 | ``web`` module)
|
447 | 434 |
|
@@ -580,8 +567,7 @@ If you decorate ``post()`` methods with the ``authenticated`` decorator,
|
580 | 567 | and the user is not logged in, the server will send a ``403`` response.
|
581 | 568 |
|
582 | 569 | Tornado comes with built-in support for third-party authentication
|
583 |
| -schemes like Google OAuth. See the ```auth`` |
584 |
| -module <http://github.com/facebook/tornado/blob/master/tornado/auth.py>`_ |
| 570 | +schemes like Google OAuth. See the `tornado.auth` |
585 | 571 | for more details. Check out the Tornado Blog example application for a
|
586 | 572 | complete example that uses authentication (and stores user data in a
|
587 | 573 | MySQL database).
|
@@ -682,7 +668,8 @@ You can serve static files from Tornado by specifying the
|
682 | 668 | application = tornado.web.Application([
|
683 | 669 | (r"/", MainHandler),
|
684 | 670 | (r"/login", LoginHandler),
|
685 |
| - (r"/(apple-touch-icon\.png)", tornado.web.StaticFileHandler, dict(path=settings['static_path'])), |
| 671 | + (r"/(apple-touch-icon\.png)", tornado.web.StaticFileHandler, |
| 672 | + dict(path=settings['static_path'])), |
686 | 673 | ], **settings)
|
687 | 674 |
|
688 | 675 | This setting will automatically make all requests that start with
|
@@ -769,7 +756,8 @@ which translates the string directly based on the current locale, and
|
769 | 756 |
|
770 | 757 | ::
|
771 | 758 |
|
772 |
| - _("A person liked this", "%(num)d people liked this", len(people)) % {"num": len(people)} |
| 759 | + _("A person liked this", "%(num)d people liked this", |
| 760 | + len(people)) % {"num": len(people)} |
773 | 761 |
|
774 | 762 | which translates a string that can be singular or plural based on the
|
775 | 763 | value of the third argument. In the example above, a translation of the
|
@@ -843,8 +831,7 @@ the user's locale is ``es_GT``, and the ``es`` locale is supported,
|
843 | 831 | ``self.locale`` will be ``es`` for that request. We fall back on
|
844 | 832 | ``en_US`` if no close match can be found.
|
845 | 833 |
|
846 |
| -See the ```locale`` |
847 |
| -module <http://github.com/facebook/tornado/blob/master/tornado/locale.py>`_ |
| 834 | +See the `tornado.locale` |
848 | 835 | documentation for detailed information on the CSV format and other
|
849 | 836 | localization methods.
|
850 | 837 |
|
|
0 commit comments