Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(96431)

Side by Side Diff: Doc/howto/webservers.rst

Issue 2830: Copy cgi.escape() to html
Patch Set: Created 8 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Doc/library/cgi.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ******************************* 1 *******************************
2 HOWTO Use Python in the web 2 HOWTO Use Python in the web
3 ******************************* 3 *******************************
4 4
5 :Author: Marek Kubica 5 :Author: Marek Kubica
6 6
7 .. topic:: Abstract 7 .. topic:: Abstract
8 8
9 This document shows how Python fits into the web. It presents some ways 9 This document shows how Python fits into the web. It presents some ways
10 to integrate Python with a web server, and general practices useful for 10 to integrate Python with a web server, and general practices useful for
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 * `nginx <http://nginx.org/>`_ also supports `FastCGI 286 * `nginx <http://nginx.org/>`_ also supports `FastCGI
287 <http://wiki.nginx.org/NginxSimplePythonFCGI>`_. 287 <http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
288 288
289 Once you have installed and configured the module, you can test it with the 289 Once you have installed and configured the module, you can test it with the
290 following WSGI-application:: 290 following WSGI-application::
291 291
292 #!/usr/bin/env python 292 #!/usr/bin/env python
293 # -*- coding: UTF-8 -*- 293 # -*- coding: UTF-8 -*-
294 294
295 import sys, os 295 import sys, os
296 from cgi import escape 296 from html import escape
297 from flup.server.fcgi import WSGIServer 297 from flup.server.fcgi import WSGIServer
298 298
299 def app(environ, start_response): 299 def app(environ, start_response):
300 start_response('200 OK', [('Content-Type', 'text/html')]) 300 start_response('200 OK', [('Content-Type', 'text/html')])
301 301
302 yield '<h1>FastCGI Environment</h1>' 302 yield '<h1>FastCGI Environment</h1>'
303 yield '<table>' 303 yield '<table>'
304 for k, v in sorted(environ.items()): 304 for k, v in sorted(environ.items()):
305 yield '<tr><th>{0}</th><td>{1}</td></tr>'.format( 305 yield '<tr><th>{0}</th><td>{1}</td></tr>'.format(
306 escape(k), escape(v)) 306 escape(k), escape(v))
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 731
732 .. seealso:: 732 .. seealso::
733 733
734 The Python wiki contains an extensive list of `web frameworks 734 The Python wiki contains an extensive list of `web frameworks
735 <http://wiki.python.org/moin/WebFrameworks>`_. 735 <http://wiki.python.org/moin/WebFrameworks>`_.
736 736
737 Most frameworks also have their own mailing lists and IRC channels, look out 737 Most frameworks also have their own mailing lists and IRC channels, look out
738 for these on the projects' web sites. There is also a general "Python in the 738 for these on the projects' web sites. There is also a general "Python in the
739 Web" IRC channel on freenode called `#python.web 739 Web" IRC channel on freenode called `#python.web
740 <http://wiki.python.org/moin/PoundPythonWeb>`_. 740 <http://wiki.python.org/moin/PoundPythonWeb>`_.
OLDNEW
« no previous file with comments | « no previous file | Doc/library/cgi.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+