推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
dracarysX
V2EX  ›  Python

一款基于 Flask 开发 restAPI 的脚手架

  •  
  •   dracarysX · Dec 22, 2016 · 4771 views
    This topic created in 3569 days ago, the information mentioned may be changed or developed.

    简介

    一款简易的 restapi 开发脚手架。服务端采用 flask , orm 使用 peewee ,表单使用 wtform 。都是轻量级框架,简单易学。实现自定义查询、表单保存,模型数据序列化, APIMethodView ( curd 操作)等。主要是实现下面好玩的查询 API ,API 格式参考。

    ##查询 API

    > curl http://127.0.0.1:5000/authors
    {"status": {"message": "200 OK", "code": 0}, "data": {"count": 0, "items": [], "limit": 10, "page": 1, "max_page": 0}}
    # 查询年龄大于 25 的作者
    > curl http://127.0.0.1:5000/authors?age=gt.25
    # 查询姓名包含 dracarys 的作者
    > curl http://127.0.0.1:5000/authors?name=like.dracarys
    # 仅仅返回作者 ID
    > curl http://127.0.0.1:5000/authors?select=id
    

    项目地址: https://github.com/dracarysX/flask_restapi 有兴趣的可以一起交流。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2251 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 00:39 · PVG 08:39 · LAX 17:39 · JFK 20:39
    ♥ Do have faith in what you're doing.