diff --git a/app/__init__.py b/app/__init__.py index 512f3de25d3ad9e3420b9236bb13acba7216a227..aa1b38419441a1c5b0f8b7e7eb278c1a3e881654 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -58,10 +58,10 @@ def create_app(test_configuration=None): ) # Register CLI commands #################################### - from .cli import create_all, drop_all + from .cli import populate_dev, drop_all with app.app_context(): - app.cli.add_command(create_all) + app.cli.add_command(populate_dev) app.cli.add_command(drop_all) # Register blueprints #################################### diff --git a/app/cli.py b/app/cli.py index 251295f54719e841f88619907b63679ffc6e5239..0a48bd6664884eefcd13e348c8f8a54e83ae20a5 100644 --- a/app/cli.py +++ b/app/cli.py @@ -2,12 +2,13 @@ import click from flask.cli import with_appcontext from .database import db +from .factories import ProjectFactory -@click.command("create_all", help="Create all tables in the app's database.") +@click.command("populate_dev", help="Create a few projects in the database.") @with_appcontext -def create_all(): - db.create_all() +def populate_dev(): + ProjectFactory.create_batch(size=4, proposer="adumble") @click.command("drop_all", help="Drop all tables in the specified database.")