Example #1
0
def init_app(app: Flask):
    app.teardown_appcontext(close_db)
Example #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()
Example #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)
Example #4
0
def init_app(app):
    init_db()
    app.teardown_appcontext(close_db)
Example #5
0
def init_app(app):
    app.teardown_appcontext(close_db)
    app.cli.add_command(init_db_command)
Example #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()