from flask import Flask, send_from_directory, abort, g, render_template from sqlalchemy.engine import create_engine import wradmin.model import wradmin.template_helper from wradmin.controllers.rodelbahn import RodelbahnController from wradmin.controllers.gasthaus import GasthausController from wradmin.controllers.bericht import BerichtController from wradmin.controllers.coordtool import CoordtoolController app = Flask(__name__) app.config.from_envvar('WRADMIN_SETTINGS') wradmin.model.init_model(create_engine(app.config['DATABASE_URI'])) app.jinja_env.globals.update(h=wradmin.template_helper.PylonsHelper()) @app.teardown_appcontext def remove_db_session(error): """Removes the database session at the end of the request.""" wradmin.model.meta.Session.remove() @app.route("/") def index(): return render_template('index.html') @app.route("/rodelbahn/list") def rodelbahn_list(): return RodelbahnController().list() @app.route("/rodelbahn/view/") def rodelbahn_view(id): return RodelbahnController().view(id) @app.route("/rodelbahn/update") def rodelbahn_update(): return RodelbahnController().update() @app.route("/rodelbahn/update_regioncache") def rodelbahn_update_regioncache(): return RodelbahnController().update_regioncache() @app.route("/bericht/list") def bericht_list(): return BerichtController().list() @app.route("/bericht/view/") def bericht_view(id): return BerichtController().view(id) @app.route("/bericht/change_date_invalid/", methods=['POST']) def bericht_change_date_invalid(id): return BerichtController().change_date_invalid(id) @app.route("/gasthaus/list") def gasthaus_list(): return GasthausController().list() @app.route("/gasthaus/view/") def gasthaus_view(id): return GasthausController().view(id) @app.route("/gasthaus/update") def gasthaus_update(): return GasthausController().update() @app.route("/coordtool/index") def coordtool_index(): return CoordtoolController().index() @app.route("/coordtool/convert", methods=['POST']) def coordtool_convert(): return CoordtoolController().convert()