A template for Python flask-restful CRUD modules

1   Introduction

This template provides a skeleton for the implementation of a REST application in Python that provides the basic CRUD services: create, read, update, and delete.

You can click here to download the template.

For more help with Flask and the flask-restful extension for Flask, see my previous post at: http://www.davekuhlman.org/python-flask-restful-rest-crud.html.

2   Instructions and guidance

Here are a few initial steps for the use of this template:

  1. Download and copy the template.

  2. Change the database and back-end store -- The template uses SQLObject for its back-end store. You will need to change that to use the Python database adapter that you want to employ.

  3. Fill in your application specific code between the comment markers "begin fill-in" and "end fill-in":

    # begin fill-in
    # ---------------------------------------
        # Your code goes here.
    # ---------------------------------------
    # end fill-in
  4. Change the name of class TaskList so that it reflects your resource type.

  5. Change the paths used to route control to you handler class so that they reflect your resource and the operations that you want your uses to be able to perform on that resource. You can find that routing under the reference to api.add_resource.