| import click | |
| from flask.cli import FlaskGroup | |
| from app import create_app, db | |
| app = create_app() | |
| cli = FlaskGroup(create_app=create_app) | |
| def init_db(): | |
| """Initialize the database.""" | |
| click.echo("Creating database tables...") | |
| db.create_all() | |
| click.echo("Database tables created!") | |
| def run(): | |
| """Run the application.""" | |
| app.run() | |
| def test(): | |
| """Run the tests.""" | |
| import pytest | |
| pytest.main(['tests']) | |
| if __name__ == "__main__": | |
| cli() |