File: README.rst

package info (click to toggle)
flask-peewee 0.6.7-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 2,308 kB
  • sloc: python: 3,826; makefile: 127
file content (112 lines) | stat: -rw-r--r-- 3,114 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
This package is in maintenance-only mode!
=========================================

I'm sorry to announce that flask-peewee will now be in maintenance-only mode. This decision is motivated by a number of factors:

* `Flask-Admin <http://flask-admin.readthedocs.org/en/latest/>`_ provides a superior admin interface and has support for peewee models.
* `Flask-Security <https://pythonhosted.org/Flask-Security/>`_ and `Flask-Login <https://flask-login.readthedocs.org/en/latest/>`_ both provide authentication functionality, and work well with Peewee.
* Most importantly, though, I do not find myself wanting to work on flask-peewee.

I plan on rewriting the ``Database`` and ``REST API`` portions of flask-peewee and repackaging them as a new library, but flask-peewee as it stands currently will be in maintenance-only mode.

flask-peewee
============

provides a layer of integration between the `flask <http://flask.pocoo.org/>`_
web framework and the `peewee orm <http://peewee.readthedocs.org/>`_.

batteries included:

* admin interface
* authentication
* rest api

requirements:

* `flask <https://github.com/mitsuhiko/flask>`_
* `peewee <https://github.com/coleifer/peewee>`_
* `wtforms <https://github.com/wtforms/wtforms>`_
* `wtf-peewee <https://github.com/coleifer/wtf-peewee>`_
* python 2.5 or greater


check out the `documentation <http://flask-peewee.readthedocs.org/>`_.


admin interface
---------------

influenced heavily by the `django <http://djangoproject.com>`_ admin, provides easy
create/edit/delete functionality for your project's models.

.. image:: http://i.imgur.com/EtzdO.jpg


rest api
--------

influenced by `tastypie <https://github.com/toastdriven/django-tastypie>`_, provides
a way to expose a RESTful interface for your project's models.

::

    curl localhost:5000/api/user/
    {
      "meta": {
        "model": "user",
        "next": "",
        "page": 1,
        "previous": ""
      },
      "objects": [
        {
          "username": "admin",
          "admin": true,
          "email": "",
          "join_date": "2011-09-16 18:34:49",
          "active": true,
          "id": 1
        },
        {
          "username": "coleifer",
          "admin": false,
          "email": "coleifer@gmail.com",
          "join_date": "2011-09-16 18:35:56",
          "active": true,
          "id": 2
        }
      ]
    }


installing
----------

I recommend installing in a virtualenv.  to get started::

    # create a new virtualenv
    virtualenv --no-site-packages project
    cd project/
    source bin/activate

    # install this project (will install dependencies as well)
    pip install flask-peewee


example app
-----------

the project ships with an example app, which is a silly twitter clone.  to
start the example app, ``cd`` into the "example" directory and execute
the ``run_example.py`` script::

    cd example/
    python run_example.py

if you would like to test out the admin area, log in as "admin/admin" and navigate to:

http://127.0.0.1:5000/admin/

you can check out the REST api at the following url:

http://127.0.0.1:5000/api/message/