1 # http://flask.pocoo.org/
2 # FLASK_APP=wradmin FLASK_DEBUG=1 WRADMIN_SETTINGS=development.cfg python3 -m flask run
3 # FLASK_APP=wradmin WRADMIN_SETTINGS=production.cfg python3 -m flask run
4 from flask import Flask, send_from_directory, abort, g
5 from sqlalchemy.engine import create_engine
7 from wradmin.genshi import render_genshi_template
8 from wradmin.controllers.rodelbahn import RodelbahnController
12 app.config.from_envvar('WRADMIN_SETTINGS')
16 """Opens a new database connection if there is none yet for the
17 current application context.
19 if not hasattr(g, 'db'):
20 g.db_engine = create_engine(app.config['DATABASE_URI'])
21 wradmin.model.init_model(g.db_engine)
22 g.db = g.db_engine.connect()
26 @app.teardown_appcontext
28 """Closes the database again at the end of the request."""
35 return render_genshi_template('index.html')
38 @app.route("/rodelbahn/list")
41 return RodelbahnController().list()
44 @app.route("/rodelbahn/update")
45 def rodelbahn_update():
49 @app.route("/rodelbahn/view/<int:id>")
50 def rodelbahn_view(id):
54 @app.route("/rodelbahn/update_regioncache")
55 def rodelbahn_update_regioncache():
59 @app.route("/bericht/list")
64 @app.route("/gasthaus/list")
69 @app.route("/coordtool/index")
70 def coordtool_index():