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

@ -3,7 +3,6 @@ import sqlite3
import click
from flask import current_app
from flask import g
from flask.cli import with_appcontext
def get_db():
@ -39,7 +38,6 @@ def init_db():
@click.command("init-db")
@with_appcontext
def init_db_command():
"""Clear existing data and create new tables."""
init_db()