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, render_template
5 from sqlalchemy.engine import create_engine
8 from wradmin.controllers.rodelbahn import RodelbahnController
9 from wradmin.controllers.gasthaus import GasthausController
10 from wradmin.controllers.bericht import BerichtController
11 from wradmin.controllers.coordtool import CoordtoolController
15 app.config.from_envvar('WRADMIN_SETTINGS')
16 wradmin.model.init_model(create_engine(app.config['DATABASE_URI']))
17 app.jinja_env.globals.update(h=wradmin.genshi.PylonsHelper())
20 @app.teardown_appcontext
21 def remove_db_session(error):
22 """Removes the database session at the end of the request."""
23 wradmin.model.meta.Session.remove()
28 return render_template('index.html')
31 @app.route("/rodelbahn/list")
33 return RodelbahnController().list()
36 @app.route("/rodelbahn/view/<int:id>")
37 def rodelbahn_view(id):
38 return RodelbahnController().view(id)
41 @app.route("/rodelbahn/update")
42 def rodelbahn_update():
43 return RodelbahnController().update()
46 @app.route("/rodelbahn/update_regioncache")
47 def rodelbahn_update_regioncache():
48 return RodelbahnController().update_regioncache()
51 @app.route("/bericht/list")
53 return BerichtController().list()
56 @app.route("/bericht/view/<int:id>")
58 return BerichtController().view(id)
61 @app.route("/bericht/change_date_invalid/<int:id>", methods=['POST'])
62 def bericht_change_date_invalid(id):
63 return BerichtController().change_date_invalid(id)
66 @app.route("/gasthaus/list")
68 return GasthausController().list()
71 @app.route("/gasthaus/view/<int:id>")
72 def gasthaus_view(id):
73 return GasthausController().view(id)
76 @app.route("/gasthaus/update")
77 def gasthaus_update():
78 return GasthausController().update()
81 @app.route("/coordtool/index")
82 def coordtool_index():
83 return CoordtoolController().index()
86 @app.route("/coordtool/convert", methods=['POST'])
87 def coordtool_convert():
88 return CoordtoolController().convert()