forked from orbit-oss/flask
Update docs to the new CLI patterns
This commit is contained in:
parent
523e271183
commit
a7d829c618
10 changed files with 112 additions and 141 deletions
|
|
@ -37,7 +37,6 @@ already established connection::
|
|||
g.sqlite_db = connect_db()
|
||||
return g.sqlite_db
|
||||
|
||||
|
||||
So now we know how to connect, but how do we properly disconnect? For
|
||||
that, Flask provides us with the :meth:`~flask.Flask.teardown_appcontext`
|
||||
decorator. It's executed every time the application context tears down::
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ databases will not commit unless you explicitly tell it to.
|
|||
|
||||
Now, it is possible to create a database with the :command:`flask` script::
|
||||
|
||||
flask --app=flaskr initdb
|
||||
flask initdb
|
||||
Initialized the database.
|
||||
|
||||
.. admonition:: Troubleshooting
|
||||
|
|
|
|||
|
|
@ -91,13 +91,16 @@ tuples.
|
|||
return rv
|
||||
|
||||
With that out of the way, you should be able to start up the application
|
||||
without problems. Do this with the following command::
|
||||
without problems. Do this with the following commands::
|
||||
|
||||
flask --app=flaskr --debug run
|
||||
export FLASK_APP=flaskr
|
||||
export FLASK_DEBUG=1
|
||||
flask run
|
||||
|
||||
The :option:`--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!
|
||||
(In case you are on Windows you need to use `set` instead of `export`).
|
||||
The :envvar:`FLASK_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!
|
||||
|
||||
You will see a message telling you that server has started along with
|
||||
the address at which you can access it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue