minor revision of documentation.
This commit is contained in:
parent
e0a8fd3162
commit
9a80fe691d
13 changed files with 32 additions and 37 deletions
|
|
@ -38,12 +38,12 @@ add this function below the `connect_db` function in :file:`flaskr.py`::
|
|||
|
||||
The ``app.cli.command()`` decorator registers a new command with the
|
||||
:command:`flask` script. When the command executes, Flask will automatically
|
||||
create a application context for us bound to the right application.
|
||||
create an application context for us bound to the right application.
|
||||
Within the function, we can then access :attr:`flask.g` and other things as
|
||||
we would expect. When the script ends, the application context tears down
|
||||
and the database connection is released.
|
||||
|
||||
We want to keep an actual functions around that initializes the database,
|
||||
We want to keep an actual function around that initializes the database,
|
||||
though, so that we can easily create databases in unit tests later on. (For
|
||||
more information see :ref:`testing`.)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ Show Entries
|
|||
This view shows all the entries stored in the database. It listens on the
|
||||
root of the application and will select title and text from the database.
|
||||
The one with the highest id (the newest entry) will be on top. The rows
|
||||
returned from the cursor look a bit like tuples because we are using
|
||||
returned from the cursor look a bit like dictionaries because we are using
|
||||
the :class:`sqlite3.Row` row factory.
|
||||
|
||||
The view function will pass the entries as dictionaries to the
|
||||
:file:`show_entries.html` template and return the rendered one::
|
||||
The view function will pass the entries to the :file:`show_entries.html`
|
||||
template and return the rendered one::
|
||||
|
||||
@app.route('/')
|
||||
def show_entries():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue