示例#1
0
文件: db.py 项目: WY123321/test_web
def init_app(app: Flask):
    app.teardown_appcontext(close_db)
示例#2
0
from app import app
from db import close_db_connection, init_db
from controllers import login, logout, add_entry, show_entries

app.config.from_object('settings')

app.route('/')(show_entries)
app.route('/add', methods=['POST'])(add_entry)
app.route('/login', methods=['GET', 'POST'])(login)
app.route('/logout')(logout)

if __name__ == '__main__':
    app.teardown_appcontext(close_db_connection)
    init_db(app)
    app.run()
示例#3
0
def init_app(app):
    """Register database functions with the Flask app. This is called by
    the application factory.
    """
    app.teardown_appcontext(close_db)
    app.cli.add_command(init_db_command)
示例#4
0
def init_app(app):
    init_db()
    app.teardown_appcontext(close_db)
示例#5
0
def init_app(app):
    app.teardown_appcontext(close_db)
    app.cli.add_command(init_db_command)
示例#6
0
from app import app
from db import close_db_connection, init_db
from controllers import login, logout, add_entry, show_entries

app.config.from_object('settings')

app.route('/')(show_entries)
app.route('/add', methods=['POST'])(add_entry)
app.route('/login', methods=['GET', 'POST'])(login)
app.route('/logout')(logout)


if __name__ == '__main__':
    app.teardown_appcontext(close_db_connection)
    init_db(app)
    app.run()