from flask.cli import FlaskGroup from src import create_app, db from src.api.models.users import User app = create_app() cli = FlaskGroup(create_app=create_app) @cli.command("recreate_db") def recreate_db(): db.drop_all() db.create_all() db.session.commit() @cli.command("seed_db") def seed_db(): db.session.add(User(username="lufthansa", email="info@lufthansa.com", password="password1234", airline=True)) db.session.add(User(username="messi", email="messi@gmail.com", password="password1234")) db.session.commit() if __name__ == "__main__": cli()