Flask-Apps

Flask-Apps provides a collection of reusable classes to streamline creation of application modules, module url routes, etc. for use as Flask modules.

Installation

Install the extension with one of the following commands:

$ easy_install Flask-Apps

or alternatively if you have pip installed:

$ pip install Flask-Apps

Usage

Apps are created as subclasses of RestfulApp (currently the only available class). Here’s an example:

from flask import Flask
from flaskext.apps import RestfulApp

app = Flask(__name__)

class ClientApp(RestfulApp):

    def index(self):
        # GET "/clients"
        pass

    def new(self):
        # GET "/clients/new"
        pass

    def create(self):
        # POST "/clients"
        pass

    def show(self, id=None):
        # GET "/clients/<id>"
        pass

    def edit(self, id=None):
        # GET "/clients/<id>/edit"
        pass

    def update(self, id=None):
        # POST "/clients/<id>"
        pass

    def delete_confirm(self, id=None):
        # GET "/clients/<id>/delete"
        pass

    def delete(self, id=None):
        # POST "/clients/<id>/delete"
        pass

clients = ClientApp("clients")
app.register_module(clients.module)

Note: “Aqua Glass” icon used in logo available via http://www.dezinerfolio.com/2007/02/25/free-aqua-gloss-icons/.

Fork me on GitHub