Giter Club home page Giter Club logo

flask-zeus's Introduction

说明

此为作者平时工作经验总结

安装

git clone https://github.com/nanlong/flask_zeus.git
cd flask_zeus
python setup.py install

或者

pip install flask-zeus

依赖

  1. python >= 3.5
  2. flask >= 0.11
  3. postgresql >= 9.5
  4. 一些flask扩展 (flask-login, flask-wtf, flask-sqlalchemy, flask-restful, WTForms-JSON, ...等等)

Example:

from app.models import Post
from app.forms import PostCreateForm, PostUpdateForm
from app.model_fields import post_fields

@api.resource('/posts/', '/posts/<int:id>/')
class PostAPI(RestfulApi):
    model = Post
    create_form = PostCreateForm
    update_form = PostUpdateForm
    model_fields = post_fields
    can_create = True
    can_update = True
    can_delete = True

说明:

api1 /posts/ 为资源列表

api2 /posts/int:id/为资源详情

两个接口都支持GET方法

两个接口都支持OPTIONS方法,用来查看接口说明.包括支持的method头部信息,不同method的请求数据说明和返回的数据说明.

对api1使用POST方法,用来创建资源

对api2使用PUT方法,用来更新资源

对api2使用DELETE方法,用来删除资源

flask-zeus's People

Contributors

nanlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.