Skip to content
Myr

Add code organization help to tutorial doc.

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

As suggested by burhan on #pocoo today.

authored by Ron DuPlain · committed by Ron DuPlain · parent 34c4709 · Browse files · 1 file+16 added−0 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+16 added−0 removed

  • other:+16 added−0 removed

1 file+16 added−0 removed

modified:docs/tutorial/dbcon.rst+16 added
37 unmodified lines
38environments. That special :data:`~flask.g` object does some magic behind39the scenes to ensure it does the right thing.4041Continue to :ref:`tutorial-views`.4243.. hint:: Where do I put this code?4445 If you've been following along in this tutorial, you might be wondering46 where to put the code from this step and the next. A logical place is to47 group these module-level functions together, and put your new48 ``before_request`` and ``teardown_request`` functions below your existing49 ``init_db`` function (following the tutorial line-by-line).5051 If you need a moment to find your bearings, take a look at how the `example52 source`_ is organized. In Flask, you can put all of your application code53 into a single Python module. You don't have to, and if your app :ref:`grows54 larger <larger-applications>`, it's a good idea not to.5556.. _example source:57 http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/