Debian Codegraph @

README.rst

raw
1 flask-peewee
2 ============
3
4 provides a layer of integration between the `flask <https://flask.palletsprojects.com/>`_
5 web framework and the `peewee orm <https://docs.peewee-orm.com/>`_.
6
7 batteries included:
8
9 * admin interface
10 * authentication
11 * rest api
12
13 requirements:
14
15 * `flask <https://github.com/pallets/flask>`_
16 * `peewee <https://github.com/coleifer/peewee>`_
17 * `wtforms <https://github.com/wtforms/wtforms>`_
18 * `wtf-peewee <https://github.com/coleifer/wtf-peewee>`_
19 * python 3.8 or greater
20
21
22 check out the `documentation <https://flask-peewee.readthedocs.io/>`_.
23
24 admin interface
25 ---------------
26
27 influenced heavily by the `django <https://djangoproject.com>`_ admin, provides easy
28 create/edit/delete functionality for your project's models.
29
30 .. image:: https://media.charlesleifer.com/blog/photos/im-1783454777-579.png
31
32 or you can use one of the themes. Here is the *crux* theme:
33
34 .. image:: https://media.charlesleifer.com/blog/photos/fp-crux-full.png
35
36 rest api
37 --------
38
39 provides a RESTful interface for your project's models.
40
41 ::
42
43 curl localhost:5000/api/user/
44 {
45 "meta": {
46 "model": "user",
47 "next": "",
48 "page": 1,
49 "previous": ""
50 },
51 "objects": [
52 {
53 "username": "admin",
54 "admin": true,
55 "email": "",
56 "join_date": "2025-09-16 18:34:49",
57 "active": true,
58 "id": 1
59 },
60 {
61 "username": "coleifer",
62 "admin": false,
63 "email": "[email protected]",
64 "join_date": "2025-09-16 18:35:56",
65 "active": true,
66 "id": 2
67 }
68 ]
69 }
70
71
72 installing
73 ----------
74
75 ::
76
77 pip install flask-peewee
78
79
80 example app
81 -----------
82
83 the project ships with an example app, which is a silly twitter clone. to
84 start the example app, ``cd`` into the "example" directory and execute
85 the ``run_example.py`` script::
86
87 cd example/
88 python run_example.py
89
90 if you would like to test out the admin area, log in as "admin/admin" and navigate to:
91
92 http://127.0.0.1:5000/admin/
93
94 you can check out the REST api at the following url:
95
96 http://127.0.0.1:5000/api/message/