cmdline.py 844 Bytes
Newer Older
Weizhi Cui's avatar
Weizhi Cui committed
1 2 3 4 5 6 7 8 9
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# @Version     : Python 3.11.4
# @Software    : Sublime Text 4
# @Author      : StudentCWZ
# @Email       : StudentCWZ@outlook.com
# @Date        : 2023/10/29 11:21
# @File        : cmdline.py
崔为之's avatar
崔为之 committed
10
# @Description : Defines the initial command line interface for the Flask application.
Weizhi Cui's avatar
Weizhi Cui committed
11 12
"""

崔为之's avatar
崔为之 committed
13
# Import third-party modules
Weizhi Cui's avatar
Weizhi Cui committed
14 15 16 17 18 19 20
import click
from flask.cli import with_appcontext


@click.command("init")
@with_appcontext
def init():
崔为之's avatar
崔为之 committed
21 22 23 24 25
    """
    Initialize the application by creating a new log entry.

    This command is to be used with the Flask application context.
    """
Weizhi Cui's avatar
Weizhi Cui committed
26 27
    from application.extensions.init_sqlalchemy import db

崔为之's avatar
崔为之 committed
28
    # Uncomment below lines to create a new log entry.
崔为之's avatar
崔为之 committed
29 30 31 32
    # click.echo("create log")
    # db.session.add(user)
    # db.session.commit()
    # click.echo("created log")