flask/examples/tutorial/README.rst

69 lines
1.2 KiB
ReStructuredText
Raw Normal View History

2018-02-10 06:39:05 +08:00
Flaskr
======
The basic blog app built in the Flask `tutorial`_.
.. _tutorial: https://flask.palletsprojects.com/tutorial/
2018-02-10 06:39:05 +08:00
Install
-------
**Be sure to use the same version of the code as the version of the docs
you're reading.** You probably want the latest tagged version, but the
2021-05-12 06:18:41 +08:00
default Git version is the main branch. ::
2018-02-10 06:39:05 +08:00
# clone the repository
$ git clone https://github.com/pallets/flask
$ cd flask
2018-02-10 06:39:05 +08:00
# checkout the correct version
$ git tag # shows the tagged versions
$ git checkout latest-tag-found-above
$ cd examples/tutorial
2018-02-10 06:39:05 +08:00
Create a virtualenv and activate it::
$ python3 -m venv venv
$ . venv/bin/activate
2018-02-10 06:39:05 +08:00
Or on Windows cmd::
$ py -3 -m venv venv
$ venv\Scripts\activate.bat
2018-02-10 06:39:05 +08:00
Install Flaskr::
$ pip install -e .
2018-02-10 06:39:05 +08:00
2021-05-12 06:18:41 +08:00
Or if you are using the main branch, install Flask from source before
2018-02-10 06:39:05 +08:00
installing Flaskr::
$ pip install -e ../..
$ pip install -e .
2018-02-10 06:39:05 +08:00
Run
---
2022-06-18 00:26:26 +08:00
.. code-block:: text
2018-02-10 06:39:05 +08:00
2022-06-18 00:26:26 +08:00
$ flask --app flaskr init-db
2022-12-30 01:52:18 +08:00
$ flask --app flaskr run --debug
2018-02-10 06:39:05 +08:00
Open http://127.0.0.1:5000 in a browser.
Test
----
::
$ pip install '.[test]'
$ pytest
2018-02-10 06:39:05 +08:00
Run with coverage report::
$ coverage run -m pytest
$ coverage report
$ coverage html # open htmlcov/index.html in a browser