skip to navigation
skip to content

flasker 0.1.30

Flask, SQLAlchemy, and Celery integration

Latest Version: 0.1.45

A configurable, lightweight framework that integrates Flask, SQLAlchemy and Celery.

  • What Flasker is!

    • A one stop .cfg configuration file for Flask, Celery and the SQLAlchemy engine.
    • A simple pattern to organize your project via the flasker.current_project proxy (cf. Structuring your project).
    • A command line tool from where you can create new projects, launch the Flask buit in Werkzeug server, start Celery workers and the Flower tool, and run a shell in the current project context.
  • What Flasker isn’t?

    • A simplified version of Flask, Celery, and SQLAlchemy. Some knowledge of these frameworks is therefore required.

Flasker also comes with two extensions for commonly needed functionalities:

  • Authentication
  • ReSTful API (still alpha)

Flasker is under development. You can find the latest version in the Flasker Git repository.


  • Installation:

    $ pip install flasker
  • To create a new project:

    $ flasker new basic

    This will create a basic project configuration file default.cfg in the current directory and a basic Bootstrap themed app (this can be turned off with the -a flag). Another sample configuration file is available via flasker new celery that includes sane defaults for task routing.

  • Next steps:

    $ flasker -h

    This will list all commands now available for that project:

    • server to run the app server
    • worker to start a worker for the Celery backend
    • flower to run the flower worker management app
    • shell to start a shell in the current project context (useful for debugging)
    • new to create a new default configuration file

    Extra help is available for each command by typing:

    $ flasker <command> -h

Structuring your project

Here is a sample minimalistic project configuration file:

NAME = My Project
MODULES = app.views, app.tasks
# SQLAlchemy engine configuration
URL = sqlite:///db/db.sqlite
# any valid Flask configuration option can go here
DEBUG = True
# any valid Celery configuration option can go here
BROKER_URL = redis://

When it starts, the flasker command line tool imports all the modules declared in the MODULES key of the configuration file (in the PROJECT section). Inside each of these you can use the flasker.current_project proxy to get access to the Flask application object, the Celery application object and the SQLAlchemy database sessions. Therefore a very simple pattern inside each module is to do:

from flask import render_template
from flasker import current_project

# the Flask application
app =

# the Celery application
celery = current_project.celery

# the SQLAlchemy scoped session maker
session = current_project.session

# normally you probably wouldn't need all three in a single file
# but you get the idea - and now you can do stuff with each...

def index():
  """A random view."""
  return render_template('index.html')

def task():
  """And a great task."""

# and so on...

Once Flasker has finished importing all your project module files and configuring the applications, it handles startup!

File Type Py Version Uploaded on Size
flasker-0.1.30.tar.gz (md5) Source 2013-02-14 24KB