File size: 539 Bytes
092e58d d488241 092e58d d488241 092e58d d488241 092e58d d488241 092e58d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import click
from flask.cli import FlaskGroup
from app import create_app, db
app = create_app()
cli = FlaskGroup(create_app=create_app)
@cli.command("init-db")
def init_db():
"""Initialize the database."""
click.echo("Creating database tables...")
db.create_all()
click.echo("Database tables created!")
@cli.command("run")
def run():
"""Run the application."""
app.run()
@cli.command("test")
def test():
"""Run the tests."""
import pytest
pytest.main(['tests'])
if __name__ == "__main__":
cli() |