Package: kit
A configurable, lightweight framework that integratesFlask,SQLAlchemy, andCelery.Configure all your applications and sessions from one file (cf.Quickstartfor an example).Run your project from the command line: Start theWerkzeugwebserver,
start Celery workers, start a shell in your project’s context (usingIPythonif available), and start theFlowermonitor using thekitcommand line tool.No more complicated import schemes:kit.Flaskandkit.Celeryalways
return the correct (and configured) application corresponding to the
module.Kit makes sure database connections are correctly handled (e.g. removed
after each request and task) under the hood. You can configure this
behavior via thekit.teardown_handlerdecorator.Check out theexamples/folder for a few sample applications or read the
full documentation onGitHub pages.Kit is under development.Installation$pipinstallkitQuickstartSample configuration file:root:'..'flasks:-modules:['my_project.app','my_project.app.views']kwargs:static_folder:'st'config:debug:yestesting:yes-modules:['my_project.api']celeries:-modules:['my_project.tasks']config:broker_url:'redis://'sessions:db:url:'mysql://...'engine:pool_recycle:3600options:commit:yesraise:nomodules:['my_project.startup']The following configuration options are available:root: project root, will be added to your python path (defaults to'.')flasks: list of Flask application settings. Each item has the following
keys available:modules: list of modules where this application is used. Inside each
of these modules, you can usekit.Flask(__name__)to recover this
configured application. The application’s name will be automatically
generated from this list of modules.kwargs: dictionary of keyword arguments passed to theflask.Flaskconstructor.config: dictionary of configuration options used to configure the
application. Names are case insensitive so no need to uppercase them.celeries: list of Celery application settings. Each item has the
following keys available:modules: list of modules where this application is used. Inside each
of these modules, you can usekit.Celery(__name__)to recover this
configured application. The application’s name will be automatically
generated from this list of modules.kwargs: dictionary of keyword arguments passed to thecelery.Celeryconstructor.config: dictionary of configuration options used to configure the
application. Names are case insensitive so no need to uppercase them.sessions: dictionary of sessions. The key is the session name (used
as argument tokit.get_session). Each item has the following
settings available:url: the database url (defaults tosqlite://)kwargs: dictionary of keyword arguments to pass tosqlalchemy.orm.sessionmaker.engine: dictionary of keyword arguments to pass to the bound engine’s
constructor.options: there are currently two options available:commit: whether or not to commit the session after each request
or task (defaults toFalse).raise: whether or not to reraise any errors found during commit
(defaults toTrue).modules: list of modules to import (and that don’t belong to an
application).You can then manage your project using thekitcommand line tool:kit shellwill start a shell in your project’s environment (all
applications and sessions will have been created and set up beforehand).kit serverwill run the Werkzeug server for one of your Flask
applications (if several applications are found, you will be prompted to
choose one).kit workerwill start a Celery worker (if more than one Celery
application exists in your project, you will be prompted to choose one).kit flowerstarts the Flower worker monitor.kit-hdisplays usage and the list of options available for each of these
commands.Next stepsTo instantiate an application outside of the command line tool (for example
to run it on a different WSGI server), you can specify apathargument
to thekit.Flaskfunction. This will load the kit before returning
the application. Thepathargument is available on all other functions as
well (for example to allow model access from an IPython notebook).