Changed the wording of some sentences there were difficult to understand.
This commit is contained in:
parent
d4f8634289
commit
0d648fa468
4 changed files with 13 additions and 20 deletions
|
|
@ -4,11 +4,10 @@ Step 2: Application Setup Code
|
|||
==============================
|
||||
|
||||
Now that we have the schema in place we can create the application module.
|
||||
Let's call it `flaskr.py` inside the `flaskr` folder. For starters we
|
||||
will add the imports and create the application object. For small
|
||||
applications it's a possibility to drop the configuration directly into
|
||||
the module which we will be doing here. However a cleaner solution would
|
||||
be to create a separate `.ini` or `.py` file and load that or import the
|
||||
Let's call it flaskr.py. We will place this file inside the flask folder.
|
||||
We will begin by adding the imports we need and by adding the config section.
|
||||
For small applications, it is possible to drop the configuration directly into
|
||||
the module, and this is what we will be doing here. However a cleaner solution would be to create a separate `.ini` or `.py` file and load that or import the
|
||||
values from there.
|
||||
|
||||
First we add the imports in `flaskr.py`::
|
||||
|
|
@ -66,9 +65,7 @@ debug flag enables or disables the interactive debugger. *Never leave
|
|||
debug mode activated in a production system*, because it will allow users to
|
||||
execute code on the server!
|
||||
|
||||
We also add a method to easily connect to the database specified. That
|
||||
can be used to open a connection on request and also from the interactive
|
||||
Python shell or a script. This will come in handy later. We create a
|
||||
We will also add a method that allows for easily connecting to the specified database. This can be used to open a connection on request and also from the interactive Python shell or a script. This will come in handy later. We create a
|
||||
simple database connection through SQLite and then tell it to use the
|
||||
:class:`sqlite3.Row` object to represent rows. This allows us to treat
|
||||
the rows as if they were dictionaries instead of tuples.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue