Traceback (most recent call last): File "c:\users\xue\documents\codings\virtualenv_ws\flask_ws\lib\site-packages\flask\cli.py", line 556, in list_commands rv.update(info.load_app().cli.list_commands(ctx)) File "c:\users\xue\documents\codings\virtualenv_ws\flask_ws\lib\site-packages\flask\cli.py", line 399, in load_app "Could not locate a Flask application. You did not provide " flask.cli.NoAppException: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py"or"app.py" module was not found in the current directory.
defregister_commands(app): @app.cli.command() @click.option('--drop', is_flag=True, help='Create after drop.') definitdb(drop): """Initialize the database.""" if drop: click.confirm('This operation will delete the database, do you want to continue?', abort=True) db.drop_all() click.echo('Drop tables.') db.create_all() click.echo('Initialized database.')
@app.cli.command() definit(): """Initialize Albumy.""" click.echo('Initializing the database...') db.create_all()
# click.echo('Initializing the roles and permissions...') # Role.init_role()
click.echo('Done.') @app.cli.command() @click.option('--user', default=10, help='Quantity of users, default is 10.') defforge(user): """Generate fake data."""