App management script

Coaster provides a Flask-Script-based manage.py with common management functions. To use in your Flask app, create a manage.py with this boilerplate:

from coaster.manage import manager, init_manager
from yourapp import app, db

@manager.command
def my_app_command()
    print "Hello!"

if __name__ == "__main__":
    # If you have no custom commands, you can skip importing manager
    # and use the return value from init_manager
    manager = init_manager(app, db)
    manager.run()

To see all available commands:

$ python manage.py --help
coaster.manage.createdb()[source]

Create database tables from sqlalchemy models

coaster.manage.dropdb()[source]

Drop database tables

coaster.manage.init_manager(app, db, **kwargs)[source]

Initialise Manager

Parameters:
  • app – Flask app object
  • kwargs – Additional keyword arguments to be made available as shell context
Parm db:

db instance

coaster.manage.set_alembic_revision(path=None)[source]

Create/Update alembic table to latest revision number

coaster.manage.sync_resources()[source]

Sync the client’s resources with the Lastuser server