# http://flask.pocoo.org/ # FLASK_APP=wradmin FLASK_DEBUG=1 WRADMIN_SETTINGS=development.cfg python3 -m flask run # FLASK_APP=wradmin WRADMIN_SETTINGS=production.cfg python3 -m flask run from flask import Flask, send_from_directory, abort, g from sqlalchemy.engine import create_engine app = Flask(__name__) app.config.from_envvar('WRADMIN_SETTINGS') def get_db(): """Opens a new database connection if there is none yet for the current application context. """ if not hasattr(g, 'db'): g.db_engine = create_engine(app.config['DATABASE_URI']) g.db = g.db_engine.connect() return g.db @app.teardown_appcontext def close_db(error): """Closes the database again at the end of the request.""" if hasattr(g, 'db'): g.db.close() @app.route("/") def hello(): return send_from_directory('templates', 'index.html') @app.route("/rodelbahn/") def rodelbahn_list(): pass @app.route("/bericht/") def bericht_list(): pass