Skip to content
Myr

Updated some typos

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixed some incorrect variable references.

authored by talam · committed by talam · parent 5d20501 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:docs/tutorial/dbcon.rst+3 added-3 removed
2 unmodified lines
3Step 3: Database Connections4----------------------------56We have created a function for establishing a database connection with7`create_db` but by itself that's not particularly useful. Creating and7`connect_db` but by itself that's not particularly useful. Creating and8closing database connections all the time is very inefficient, so we want9to keep it around for longer. Because database connections encapsulate a10transaction we also need to make sure that only one request at the time11uses the connection. So how can we elegantly do that with Flask?
9 unmodified lines
21variable associated with the current application context. We will go into22the details of this a bit later.2324For the time being all you have to know is that you can store information25savely on the :data:`~flask.g` object.25safely on the :data:`~flask.g` object.2627So when do you put it on there? To do that you can make a helper28function. The first time the function is called it will create a database29connection for the current context and successive calls will return the
36 unmodified lines
66 If you've been following along in this tutorial, you might be wondering67 where to put the code from this step and the next. A logical place is to68 group these module-level functions together, and put your new69 ``get_db`` and ``close_db`` functions below your existing70 ``init_db`` function (following the tutorial line-by-line).70 ``connect_db`` function (following the tutorial line-by-line).7172 If you need a moment to find your bearings, take a look at how the `example73 source`_ is organized. In Flask, you can put all of your application code74 into a single Python module. You don't have to, and if your app :ref:`grows
4 unmodified lines