Browse Source

Merge pull request #683 from alexcouper/master

Tiny changes to docs
pull/681/merge
Kenneth Reitz 12 years ago
parent
commit
aa83d9132f
  1. 17
      docs/patterns/templateinheritance.rst
  2. 17
      docs/quickstart.rst

17
docs/patterns/templateinheritance.rst

@ -28,14 +28,15 @@ document that you might use for a simple two-column page. It's the job of
<title>{% block title %}{% endblock %} - My Webpage</title> <title>{% block title %}{% endblock %} - My Webpage</title>
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
<div id="content">{% block content %}{% endblock %}</div> <div id="content">{% block content %}{% endblock %}</div>
<div id="footer"> <div id="footer">
{% block footer %} {% block footer %}
&copy; Copyright 2010 by <a href="http://domain.invalid/">you</a>. &copy; Copyright 2010 by <a href="http://domain.invalid/">you</a>.
{% endblock %} {% endblock %}
</div> </div>
</body> </body>
</html>
In this example, the ``{% block %}`` tags define four blocks that child templates In this example, the ``{% block %}`` tags define four blocks that child templates
can fill in. All the `block` tag does is tell the template engine that a can fill in. All the `block` tag does is tell the template engine that a

17
docs/quickstart.rst

@ -38,15 +38,14 @@ should see your hello world greeting.
So what did that code do? So what did that code do?
1. First we imported the :class:`~flask.Flask` class. An instance of this 1. First we imported the :class:`~flask.Flask` class. An instance of this
class will be our WSGI application. The first argument is the name of class will be our WSGI application.
the application's module. If you are using a single module (as in this 2. Next we create an instance of this class. The first argument is the name of
example), you should use `__name__` because depending on if it's started as the application's module or package. If you are using a single module (as
application or imported as module the name will be different (``'__main__'`` in this example), you should use `__name__` because depending on if it's
versus the actual import name). For more information, have a look at the started as application or imported as module the name will be different
:class:`~flask.Flask` documentation. (``'__main__'`` versus the actual import name). This is needed so that
2. Next we create an instance of this class. We pass it the name of the module Flask knows where to look for templates, static files, and so on. For more
or package. This is needed so that Flask knows where to look for templates, information have a look at the :class:`~flask.Flask` documentation.
static files, and so on.
3. We then use the :meth:`~flask.Flask.route` decorator to tell Flask what URL 3. We then use the :meth:`~flask.Flask.route` decorator to tell Flask what URL
should trigger our function. should trigger our function.
4. The function is given a name which is also used to generate URLs for that 4. The function is given a name which is also used to generate URLs for that

Loading…
Cancel
Save