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/update")
47 def rodelbahn_update():
51 @app.route("/rodelbahn/view/<int:id>")
52 def rodelbahn_view(id):
54 return RodelbahnController().view(id)
57 @app.route("/rodelbahn/update_regioncache")
58 def rodelbahn_update_regioncache():
62 @app.route("/bericht/list")
65 return BerichtController().list()
68 @app.route("/bericht/view/<int:id>")
71 return BerichtController().view(id)
74 @app.route("/gasthaus/list")
77 return GasthausController().list()
80 @app.route("/gasthaus/view/<int:id>")
81 def gasthaus_view(id):
83 return GasthausController().view(id)
86 @app.route("/gasthaus/update")
87 def gasthaus_update():
89 return GasthausController().update()
92 @app.route("/coordtool/index")
93 def coordtool_index():