with_appcontext lasts for the lifetime of the click context

This commit is contained in:
David Lord 2022-06-17 11:14:22 -07:00
parent ae547270e9
commit c9e000b9ce
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
6 changed files with 65 additions and 26 deletions

View file

@ -40,7 +40,6 @@ response is sent.
import click
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
@ -128,7 +127,6 @@ Add the Python functions that will run these SQL commands to the
@click.command('init-db')
@with_appcontext
def init_db_command():
"""Clear the existing data and create new tables."""
init_db()