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
9 from wradmin.controllers.gasthaus import GasthausController
13 app.config.from_envvar('WRADMIN_SETTINGS')
17 """Opens a new database connection if there is none yet for the
18 current application context.
20 if not hasattr(g, 'db'):
21 g.db_engine = create_engine(app.config['DATABASE_URI'])
22 wradmin.model.init_model(g.db_engine)
23 g.db = g.db_engine.connect()
27 @app.teardown_appcontext
29 """Closes the database again at the end of the request."""
36 return render_genshi_template('index.html')
39 @app.route("/rodelbahn/list")
42 return RodelbahnController().list()
45 @app.route("/rodelbahn/update")
46 def rodelbahn_update():
50 @app.route("/rodelbahn/view/<int:id>")
51 def rodelbahn_view(id):
55 @app.route("/rodelbahn/update_regioncache")
56 def rodelbahn_update_regioncache():
60 @app.route("/bericht/list")
65 @app.route("/gasthaus/list")
68 return GasthausController().list()
71 @app.route("/gasthaus/view/<int:id>")
74 return GasthausController().view(id)
77 @app.route("/gasthaus/update")
78 def gasthaus_update():
80 return GasthausController().update()
83 @app.route("/coordtool/index")
84 def coordtool_index():