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 init_manager
from hgapp import app, db, init_for
manager = init_manager(app, db, init_for)
if __name__ == "__main__":
manager.run()
To see all available commands:
$ python manage.py --help
-
class coaster.manage.InitedMigrations(impl=<function main at 0x1083a6a28>)[source]
Perform Alembic database migration operations
-
coaster.manage.create(env)[source]
Create database tables from sqlalchemy models
-
coaster.manage.drop(env)[source]
Drop database tables
-
coaster.manage.init_manager(app, db, init_for, **kwargs)[source]
Initialise Manager
Parameters: |
- app – Flask app object
- init_for – init_for function which is normally present in __init__.py of hgapp.
|
Parm db: | db instance
|
-
coaster.manage.plainshell(env)[source]
Initiate a plain Python shell
-
coaster.manage.set_alembic_revision(path=None)[source]
Create/Update alembic table to latest revision number
-
coaster.manage.shell(env, no_ipython=False, no_bpython=False)[source]
Initiate a Python shell
-
coaster.manage.sync_resources(env)[source]
Sync the client’s resources with the Lastuser server