flask-peewee

集成了 peewee 的 flask,包括管理、身份验证、rest api 等。「flask integration for peewee, including admin, authentication, rest api and more」

Github星跟蹤圖

这个软件包已经进入维护模式!

我很抱歉地宣布,flask-peewee 现在将进入只维护模式。这个决定是出于多种因素的考虑。

Flask-Admin 提供了一个优秀的管理界面,并且支持 peewee 模型。

Flask-SecurityFlask-Login 都提供了认证功能,并且与 Peewee 配合得很好。

不过最重要的是,我发现自己并不想在 flask-peewee 上工作。

我计划重写 flask-peewee 的数据库和 REST API 部分,并将它们重新打包成一个新的库,但 flask-peewee 目前的状态将只处于维护模式。

flask-peewee

flask web 框架和 peewee orm 之间提供了一层集成。

内置功能:

  • 管理界面
  • 认证
  • rest api

要求

查看文档

管理接口

在很大程度上受到 django admin 的影响,为你的项目提供了简单的创建/编辑/删除模型的功能。

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

rest api

tastypie 的影响,提供了一种为你的项目模型提供 RESTful 接口的方法。

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
    }
  ]
}

安装

我建议在 virtualenv 中安装,以便开始使用。

# 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

示例应用

要启动这个示例应用程序,请将目录 cd 到 "example" 目录下,并执行 run_example.py 脚本。

cd example/
python run_example.py

如果你想测试管理区,以 "admin/admin" 的身份登录,然后导航到。

http://127.0.0.1:5000/admin/

你可以在以下网址查看REST api。

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


(The first version translated by vz on 2020.09.13)

主要指標

概覽
名稱與所有者coleifer/flask-peewee
主編程語言Python
編程語言CSS (語言數: 4)
平台Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2011-09-16 23:32:56
推送於2024-04-11 12:57:30
最后一次提交2024-04-11 07:57:14
發布數32
最新版本名稱3.0.6 (發布於 )
第一版名稱0.1.0 (發布於 )
用户参与
星數782
關注者數41
派生數177
提交數391
已啟用問題?
問題數139
打開的問題數25
拉請求數21
打開的拉請求數9
關閉的拉請求數22
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

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 <https://flask-admin.readthedocs.io/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.io/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 <https://peewee.readthedocs.io/>_.

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 <https://flask-peewee.readthedocs.io/>_.

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/