June 2015
Intermediate to advanced
160 pages
3h 22m
English
Flask-Restless is an extension capable of auto-generating a whole RESTful API for your SQLAlchemy models with support for GET, POST, PUT, and DELETE. Most Web services won't need more than that. Another advantage to using Flask-Restless is the chance to extend the auto-generated methods with authentication validation, custom behavior, and custom queries. This is a must-learn extension!
Let's see how our Web service would look with Flask-Restless. We'll also have to install a new library for this example:
pip install Flask-Restless
And then:
# coding:utf-8 from flask import Flask, url_for from flask.ext.restless import APIManager from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SECRET_KEY'] = 'secret' app.config['SQLALCHEMY_DATABASE_URI'] ...