summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 6433ba240d0007ec0800aab17ff896cc45bc8607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# flask-tutorial

https://flask.palletsprojects.com/en/3.0.x/tutorial

## Installation

```bash
python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt
flask --app flaskr run --debug
```

## Learning resources

* https://flask.palletsprojects.com/en/3.0.x/#user-s-guide
* https://sqlite.org/lang.html

Concepts:

* flask.g: Store data.  Unique for each request
* flask.current_app:  Link to Flask app
* flask.open_resource:  From app package path
* request: HTML request???
* Factory function > registered functions and blueprints.
* Blueprint: groups views & other code
* View: function that returns HTML
* flask.session: dict that stores data across requests (cookies) (securely
  signed with SECRET_KEY)
* *endpoint*: name associated with a view, `<blueprint_name>.<view_function_name>`

Gotchas:

* Remember to call db.commit() after modifying DB (DML).