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