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
10 from wradmin.controllers.bericht import BerichtController
14 app.config.from_envvar('WRADMIN_SETTINGS')
18 """Opens a new database connection if there is none yet for the
19 current application context.
21 if not hasattr(g, 'db'):
22 g.db_engine = create_engine(app.config['DATABASE_URI'])
23 wradmin.model.init_model(g.db_engine)
24 g.db = g.db_engine.connect()
28 @app.teardown_appcontext
30 """Closes the database again at the end of the request."""
37 return render_genshi_template('index.html')
40 @app.route("/rodelbahn/list")
43 return RodelbahnController().list()
46 @app.route("/rodelbahn/view/<int:id>")
47 def rodelbahn_view(id):
49 return RodelbahnController().view(id)
52 @app.route("/rodelbahn/update")
53 def rodelbahn_update():
55 return RodelbahnController().update()
58 @app.route("/rodelbahn/update_regioncache")
59 def rodelbahn_update_regioncache():
63 @app.route("/bericht/list")
66 return BerichtController().list()
69 @app.route("/bericht/view/<int:id>")
72 return BerichtController().view(id)
75 @app.route("/bericht/change_date_invalid/<int:id>", methods=['POST'])
76 def bericht_change_date_invalid(id):
78 return BerichtController().view(id)
81 @app.route("/gasthaus/list")
84 return GasthausController().list()
87 @app.route("/gasthaus/view/<int:id>")
88 def gasthaus_view(id):
90 return GasthausController().view(id)
93 @app.route("/gasthaus/update")
94 def gasthaus_update():
96 return GasthausController().update()
99 @app.route("/coordtool/index")
100 def coordtool_index():