Started working on documentation.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
So far just the stable parts :)
authored by Armin Ronacher · committed by Armin Ronacher · parent b15ad39 · Browse files · 9 files·+641 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+641 added−9 removed
- other:+641 added−9 removed
Provenance
- Commit
4ec7d2a- Tree
e7d4bd1- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
b15ad39
9 files changed+641 added−9 removed
added:docs/.gitignore+1 added
1+_buildadded:docs/api.rst+15 added
1+API2+===3+4+.. module:: flask5+6+This part of the documentation covers all the interfaces of Flask. For7+parts where Flask depends on external libraries, we document the most8+important right here and provide links to the canonical documentation.9+10+11+General Structure12+-----------------13+14+.. autoclass:: Flask15+ :members:added:docs/conf.py+236 added
1+# -*- coding: utf-8 -*-2+#3+# Flask documentation build configuration file, created by4+# sphinx-quickstart on Tue Apr 6 15:24:58 2010.5+#6+# This file is execfile()d with the current directory set to its containing dir.7+#8+# Note that not all possible configuration values are present in this9+# autogenerated file.10+#11+# All configuration values have a default; values that are commented out12+# serve to show the default.13+14+import sys, os15+16+# If extensions (or modules to document with autodoc) are in another directory,17+# add these directories to sys.path here. If the directory is relative to the18+# documentation root, use os.path.abspath to make it absolute, like shown here.19+#sys.path.append(os.path.abspath('.'))20+21+# -- General configuration -----------------------------------------------------22+23+# If your documentation needs a minimal Sphinx version, state it here.24+#needs_sphinx = '1.0'25+26+# Add any Sphinx extension module names here, as strings. They can be extensions27+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.28+extensions = ['sphinx.ext.autodoc']29+30+# Add any paths that contain templates here, relative to this directory.31+templates_path = ['_templates']32+33+# The suffix of source filenames.34+source_suffix = '.rst'35+36+# The encoding of source files.37+#source_encoding = 'utf-8-sig'38+39+# The master toctree document.40+master_doc = 'index'41+42+# General information about the project.43+project = u'Flask'44+copyright = u'2010, Armin Ronacher'45+46+import pkg_resources47+48+# The version info for the project you're documenting, acts as replacement for49+# |version| and |release|, also used in various other places throughout the50+# built documents.51+release = __import__('pkg_resources').get_distribution('Flask').version52+version = '.'.join(release.split('.')[:2])53+54+# The language for content autogenerated by Sphinx. Refer to documentation55+# for a list of supported languages.56+#language = None57+58+# There are two options for replacing |today|: either, you set today to some59+# non-false value, then it is used:60+#today = ''61+# Else, today_fmt is used as the format for a strftime call.62+#today_fmt = '%B %d, %Y'63+64+# List of patterns, relative to source directory, that match files and65+# directories to ignore when looking for source files.66+exclude_patterns = ['_build']67+68+# The reST default role (used for this markup: `text`) to use for all documents.69+#default_role = None70+71+# If true, '()' will be appended to :func: etc. cross-reference text.72+#add_function_parentheses = True73+74+# If true, the current module name will be prepended to all description75+# unit titles (such as .. function::).76+#add_module_names = True77+78+# If true, sectionauthor and moduleauthor directives will be shown in the79+# output. They are ignored by default.80+#show_authors = False81+82+# The name of the Pygments (syntax highlighting) style to use.83+pygments_style = 'sphinx'84+85+# A list of ignored prefixes for module index sorting.86+#modindex_common_prefix = []87+88+89+# -- Options for HTML output ---------------------------------------------------90+91+# The theme to use for HTML and HTML Help pages. Major themes that come with92+# Sphinx are currently 'default' and 'sphinxdoc'.93+html_theme = 'nature'94+95+# Theme options are theme-specific and customize the look and feel of a theme96+# further. For a list of options available for each theme, see the97+# documentation.98+#html_theme_options = {}99+100+# Add any paths that contain custom themes here, relative to this directory.101+#html_theme_path = []102+103+# The name for this set of Sphinx documents. If None, it defaults to104+# "<project> v<release> documentation".105+#html_title = None106+107+# A shorter title for the navigation bar. Default is the same as html_title.108+#html_short_title = None109+110+# The name of an image file (relative to this directory) to place at the top111+# of the sidebar.112+#html_logo = None113+114+# The name of an image file (within the static path) to use as favicon of the115+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32116+# pixels large.117+#html_favicon = None118+119+# Add any paths that contain custom static files (such as style sheets) here,120+# relative to this directory. They are copied after the builtin static files,121+# so a file named "default.css" will overwrite the builtin "default.css".122+html_static_path = ['_static']123+124+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,125+# using the given strftime format.126+#html_last_updated_fmt = '%b %d, %Y'127+128+# If true, SmartyPants will be used to convert quotes and dashes to129+# typographically correct entities.130+#html_use_smartypants = True131+132+# Custom sidebar templates, maps document names to template names.133+#html_sidebars = {}134+135+# Additional templates that should be rendered to pages, maps page names to136+# template names.137+#html_additional_pages = {}138+139+# If false, no module index is generated.140+#html_use_modindex = True141+142+# If false, no index is generated.143+#html_use_index = True144+145+# If true, the index is split into individual pages for each letter.146+#html_split_index = False147+148+# If true, links to the reST sources are added to the pages.149+#html_show_sourcelink = True150+151+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.152+#html_show_sphinx = True153+154+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.155+#html_show_copyright = True156+157+# If true, an OpenSearch description file will be output, and all pages will158+# contain a <link> tag referring to it. The value of this option must be the159+# base URL from which the finished HTML is served.160+#html_use_opensearch = ''161+162+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").163+#html_file_suffix = ''164+165+# Output file base name for HTML help builder.166+htmlhelp_basename = 'Flaskdoc'167+168+169+# -- Options for LaTeX output --------------------------------------------------170+171+# The paper size ('letter' or 'a4').172+#latex_paper_size = 'letter'173+174+# The font size ('10pt', '11pt' or '12pt').175+#latex_font_size = '10pt'176+177+# Grouping the document tree into LaTeX files. List of tuples178+# (source start file, target name, title, author, documentclass [howto/manual]).179+latex_documents = [180+ ('index', 'Flask.tex', u'Flask Documentation',181+ u'Armin Ronacher', 'manual'),182+]183+184+# The name of an image file (relative to this directory) to place at the top of185+# the title page.186+#latex_logo = None187+188+# For "manual" documents, if this is true, then toplevel headings are parts,189+# not chapters.190+#latex_use_parts = False191+192+# Additional stuff for the LaTeX preamble.193+#latex_preamble = ''194+195+# Documents to append as an appendix to all manuals.196+#latex_appendices = []197+198+# If false, no module index is generated.199+#latex_use_modindex = True200+201+202+# -- Options for Epub output ---------------------------------------------------203+204+# Bibliographic Dublin Core info.205+#epub_title = ''206+#epub_author = ''207+#epub_publisher = ''208+#epub_copyright = ''209+210+# The language of the text. It defaults to the language option211+# or en if the language is not set.212+#epub_language = ''213+214+# The scheme of the identifier. Typical schemes are ISBN or URL.215+#epub_scheme = ''216+217+# The unique identifier of the text. This can be a ISBN number218+# or the project homepage.219+#epub_identifier = ''220+221+# A unique identification for the text.222+#epub_uid = ''223+224+# HTML files that should be inserted before the pages created by sphinx.225+# The format is a list of tuples containing the path and title.226+#epub_pre_files = []227+228+# HTML files shat should be inserted after the pages created by sphinx.229+# The format is a list of tuples containing the path and title.230+#epub_post_files = []231+232+# A list of files that should not be packed into the epub file.233+#epub_exclude_files = []234+235+# The depth of the table of contents in toc.ncx.236+#epub_tocdepth = 3added:docs/index.rst+11 added
1+Welcome to Flask2+================3+4+Welcome to Flask's documentation.5+6+Contents:7+8+.. toctree::9+ :maxdepth: 210+11+ apiadded:docs/make.bat+139 added
1+@ECHO OFF2+3+REM Command file for Sphinx documentation4+5+if "%SPHINXBUILD%" == "" (6+ set SPHINXBUILD=sphinx-build7+)8+set BUILDDIR=_build9+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .10+if NOT "%PAPER%" == "" (11+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%12+)13+14+if "%1" == "" goto help15+16+if "%1" == "help" (17+ :help18+ echo.Please use `make ^<target^>` where ^<target^> is one of19+ echo. html to make standalone HTML files20+ echo. dirhtml to make HTML files named index.html in directories21+ echo. singlehtml to make a single large HTML file22+ echo. pickle to make pickle files23+ echo. json to make JSON files24+ echo. htmlhelp to make HTML files and a HTML help project25+ echo. qthelp to make HTML files and a qthelp project26+ echo. devhelp to make HTML files and a Devhelp project27+ echo. epub to make an epub28+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter29+ echo. changes to make an overview over all changed/added/deprecated items30+ echo. linkcheck to check all external links for integrity31+ echo. doctest to run all doctests embedded in the documentation if enabled32+ goto end33+)34+35+if "%1" == "clean" (36+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i37+ del /q /s %BUILDDIR%\*38+ goto end39+)40+41+if "%1" == "html" (42+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html43+ echo.44+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.45+ goto end46+)47+48+if "%1" == "dirhtml" (49+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml50+ echo.51+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.52+ goto end53+)54+55+if "%1" == "singlehtml" (56+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml57+ echo.58+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.59+ goto end60+)61+62+if "%1" == "pickle" (63+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle64+ echo.65+ echo.Build finished; now you can process the pickle files.66+ goto end67+)68+69+if "%1" == "json" (70+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json71+ echo.72+ echo.Build finished; now you can process the JSON files.73+ goto end74+)75+76+if "%1" == "htmlhelp" (77+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp78+ echo.79+ echo.Build finished; now you can run HTML Help Workshop with the ^80+.hhp project file in %BUILDDIR%/htmlhelp.81+ goto end82+)83+84+if "%1" == "qthelp" (85+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp86+ echo.87+ echo.Build finished; now you can run "qcollectiongenerator" with the ^88+.qhcp project file in %BUILDDIR%/qthelp, like this:89+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Flask.qhcp90+ echo.To view the help file:91+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Flask.ghc92+ goto end93+)94+95+if "%1" == "devhelp" (96+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% _build/devhelp97+ echo.98+ echo.Build finished.99+ goto end100+)101+102+if "%1" == "epub" (103+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub104+ echo.105+ echo.Build finished. The epub file is in %BUILDDIR%/epub.106+ goto end107+)108+109+if "%1" == "latex" (110+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex111+ echo.112+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.113+ goto end114+)115+116+if "%1" == "changes" (117+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes118+ echo.119+ echo.The overview file is in %BUILDDIR%/changes.120+ goto end121+)122+123+if "%1" == "linkcheck" (124+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck125+ echo.126+ echo.Link check complete; look for any errors in the above output ^127+or in %BUILDDIR%/linkcheck/output.txt.128+ goto end129+)130+131+if "%1" == "doctest" (132+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest133+ echo.134+ echo.Testing of doctests in the sources finished, look at the ^135+results in %BUILDDIR%/doctest/output.txt.136+ goto end137+)138+139+:endadded:docs/Makefile+118 added
1+# Makefile for Sphinx documentation2+#3+4+# You can set these variables from the command line.5+SPHINXOPTS =6+SPHINXBUILD = sphinx-build7+PAPER =8+BUILDDIR = _build9+10+# Internal variables.11+PAPEROPT_a4 = -D latex_paper_size=a412+PAPEROPT_letter = -D latex_paper_size=letter13+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .14+15+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp epub latex changes linkcheck doctest16+17+help:18+ @echo "Please use \`make <target>' where <target> is one of"19+ @echo " html to make standalone HTML files"20+ @echo " dirhtml to make HTML files named index.html in directories"21+ @echo " singlehtml to make a single large HTML file"22+ @echo " pickle to make pickle files"23+ @echo " json to make JSON files"24+ @echo " htmlhelp to make HTML files and a HTML help project"25+ @echo " qthelp to make HTML files and a qthelp project"26+ @echo " devhelp to make HTML files and a Devhelp project"27+ @echo " epub to make an epub"28+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"29+ @echo " latexpdf to make LaTeX files and run them through pdflatex"30+ @echo " changes to make an overview of all changed/added/deprecated items"31+ @echo " linkcheck to check all external links for integrity"32+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"33+34+clean:35+ -rm -rf $(BUILDDIR)/*36+37+html:38+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html39+ @echo40+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."41+42+dirhtml:43+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml44+ @echo45+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."46+47+singlehtml:48+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml49+ @echo50+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."51+52+pickle:53+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle54+ @echo55+ @echo "Build finished; now you can process the pickle files."56+57+json:58+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json59+ @echo60+ @echo "Build finished; now you can process the JSON files."61+62+htmlhelp:63+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp64+ @echo65+ @echo "Build finished; now you can run HTML Help Workshop with the" \66+ ".hhp project file in $(BUILDDIR)/htmlhelp."67+68+qthelp:69+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp70+ @echo71+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \72+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"73+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask.qhcp"74+ @echo "To view the help file:"75+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask.qhc"76+77+devhelp:78+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) _build/devhelp79+ @echo80+ @echo "Build finished."81+ @echo "To view the help file:"82+ @echo "# mkdir -p $$HOME/.local/share/devhelp/Flask"83+ @echo "# ln -s _build/devhelp $$HOME/.local/share/devhelp/Flask"84+ @echo "# devhelp"85+86+epub:87+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub88+ @echo89+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."90+91+latex:92+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex93+ @echo94+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."95+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \96+ "run these through (pdf)latex."97+98+latexpdf: latex99+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex100+ @echo "Running LaTeX files through pdflatex..."101+ make -C _build/latex all-pdf102+ @echo "pdflatex finished; the PDF files are in _build/latex."103+104+changes:105+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes106+ @echo107+ @echo "The overview file is in $(BUILDDIR)/changes."108+109+linkcheck:110+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck111+ @echo112+ @echo "Link check complete; look for any errors in the above output " \113+ "or in $(BUILDDIR)/linkcheck/output.txt."114+115+doctest:116+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest117+ @echo "Testing of doctests in the sources finished, look at the " \118+ "results in $(BUILDDIR)/doctest/output.txt."modified:examples/minitwit/minitwit.py+1 added-1 removed
55 unmodified lines56 57 def gravatar_url(email, size=80):58 """Return the gravatar image for the given email address"""59 return 'http://www.gravatar.com/avatar/%s?d=identicon&s=%d' % \60- (md5(email.lower().encode('utf-8')).hexdigest(), size)60+ (md5(email.strip().lower().encode('utf-8')).hexdigest(), size)61 62 63 @app.request_init64 def before_request():164 unmodified linesmodified:.gitignore+1 added
1 .DS_Store2 *.pyc3 *.pyo4 env5+*.egg-infomodified:flask.py+119 added-8 removed
123 unmodified lines124 125 126 class Flask(object):127 """The flask object implements a WSGI application and acts as the central128- object. It is passed the name of the module or package of the application129- and optionally a configuration. When it's created it sets up the130- template engine and provides ways to register view functions.128+ object. It is passed the name of the module or package of the129+ application. Once it is created it will act as a central registry for130+ the view functions, the URL rules, template configuration and much more.131+132+ The name of the package is used to resolve resources from inside the133+ package or the folder the module is contained in depending on if the134+ package parameter resolves to an actual python package (a folder with135+ an `__init__.py` file inside) or a standard module (just a `.py` file).136+137+ For more information about resource loading, see :func:`open_resource`.138+139+ Usually you create a :class:`Flask` instance in your main module or140+ in the `__init__.py` file of your package like this::141+142+ from flask import Flask143+ app = Flask(__name__)144 """145 146 #: the class that is used for request objects147 request_class = FlaskRequest20 unmodified lines168 extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_']169 )170 171 def __init__(self, package_name):172+ #: the debug flag. Set this to `True` to enable debugging of173+ #: the application. In debug mode the debugger will kick in174+ #: when an unhandled exception ocurrs and the integrated server175+ #: will automatically reload the application if changes in the176+ #: code are detected.177 self.debug = False178+179+ #: the name of the package or module. Do not change this once180+ #: it was set by the constructor.181 self.package_name = package_name182+183+ #: a dictionary of all view functions registered. The keys will184+ #: be function names which are also used to generate URLs and185+ #: the values are the function objects themselves.186+ #: to register a view function, use the :meth:`route` decorator.187 self.view_functions = {}188+189+ #: a dictionary of all registered error handlers. The key is190+ #: be the error code as integer, the value the function that191+ #: should handle that error.192+ #: To register a error handler, use the :meth:`errorhandler`193+ #: decorator.194 self.error_handlers = {}195+196+ #: a list of functions that should be called at the beginning197+ #: of the request before request dispatching kicks in. This198+ #: can for example be used to open database connections or199+ #: getting hold of the currently logged in user.200+ #: To register a function here, use the :meth:`request_init`201+ #: decorator.202 self.request_init_funcs = []203+204+ #: a list of functions that are called at the end of the205+ #: request. Tha function is passed the current response206+ #: object and modify it in place or replace it.207+ #: To register a function here use the :meth:`request_shtdown`208+ #: decorator.209 self.request_shutdown_funcs = []210 self.url_map = Map()211 212 if self.static_path is not None:213 self.url_map.add(Rule(self.static_path + '/<filename>',214 build_only=True, endpoint='static'))215 216+ #: the Jinja2 environment. It is created from the217+ #: :attr:`jinja_options` and the loader that is returned218+ #: by the :meth:`create_jinja_loader` function.219 self.jinja_env = Environment(loader=self.create_jinja_loader(),220 **self.jinja_options)221 self.jinja_env.globals.update(222 url_for=url_for,11 unmodified lines234 """235 return PackageLoader(self.package_name)236 237 def run(self, host='localhost', port=5000, **options):190- """Runs the application on a local development server"""238+ """Runs the application on a local development server. If the239+ :attr:`debug` flag is set the server will automatically reload240+ for code changes and show a debugger in case an exception happened.241+ """242 from werkzeug import run_simple243 if 'debug' in options:244 self.debug = options.pop('debug')245 if self.static_path is not None:10 unmodified lines256 from werkzeug import Client257 return Client(self, self.response_class, use_cookies=True)258 259 def open_resource(self, resource):209- """Opens a resource from the application's resource folder"""260+ """Opens a resource from the application's resource folder. To see261+ how this works, consider the following folder structure::262+263+ /myapplication.py264+ /schemal.sql265+ /static266+ /style.css267+ /template268+ /layout.html269+ /index.html270+271+ If you want to open the `schema.sql` file you would do the272+ following::273+274+ with app.open_resource('schema.sql') as f:275+ contents = f.read()276+ do_something_with(contents)277+ """278 return pkg_resources.resource_stream(self.package_name, resource)279 280 def open_session(self, request):213- """Creates or opens a new session. Default implementation requires214- that `securecookie.secret_key` is set.281+ """Creates or opens a new session. Default implementation stores all282+ session data in a signed cookie. This requires that the283+ :attr:`secret_key` is set.284 """285 key = self.secret_key286 if key is not None:287 return SecureCookie.load_cookie(request, self.session_cookie_name,288 secret_key=key)289 290 def save_session(self, session, response):222- """Saves the session if it needs updates."""291+ """Saves the session if it needs updates. For the default292+ implementation, check :meth:`open_session`.293+ """294 if session is not None:295 session.save_cookie(response, self.session_cookie_name)296 297 def route(self, rule, **options):2 unmodified lines300 301 @app.route('/')302 def index():303 return 'Hello World'304+305+ Variables parts in the route can be specified with angular306+ brackets (``/user/<username>``). By default a variable part307+ in the URL accepts any string without a slash however a differnt308+ converter can be specified as well by using ``<converter:name>``.309+310+ Variable parts are passed to the view function as keyword311+ arguments.312+313+ The following converters are possible:314+315+ =========== ===========================================316+ `int` accepts integers317+ `float` like `int` but for floating point values318+ `path` like the default but also accepts slashes319+ =========== ===========================================320+321+ Here some examples::322+323+ @app.route('/')324+ def index():325+ pass326+327+ @app.route('/<username>')328+ def show_user(username):329+ pass330+331+ @app.route('/post/<int:post_id>')332+ def show_post(post_id):333+ pass334+335+ The :meth:`route` decorator accepts a couple of other arguments336+ as well:337+338+ :param methods: a list of methods this rule should be limited339+ to (``GET``, ``POST`` etc.)340+ :param subdomain: specifies the rule for the subdoain in case341+ subdomain matching is in use.342+ :param strict_slashes: can be used to disable the strict slashes343+ setting for this rule. See above.344 """345 def decorator(f):346 if 'endpoint' not in options:347 options['endpoint'] = f.__name__120 unmodified lines