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
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']))
19 @app.teardown_appcontext
20 def remove_db_session(error):
21 """Removes the database session at the end of the request."""
22 wradmin.model.meta.Session.remove()
27 return render_genshi_template('index.html')
30 @app.route("/rodelbahn/list")
32 return RodelbahnController().list()
35 @app.route("/rodelbahn/view/<int:id>")
36 def rodelbahn_view(id):
37 return RodelbahnController().view(id)
40 @app.route("/rodelbahn/update")
41 def rodelbahn_update():
42 return RodelbahnController().update()
45 @app.route("/rodelbahn/update_regioncache")
46 def rodelbahn_update_regioncache():
47 return RodelbahnController().update_regioncache()
50 @app.route("/bericht/list")
52 return BerichtController().list()
55 @app.route("/bericht/view/<int:id>")
57 return BerichtController().view(id)
60 @app.route("/bericht/change_date_invalid/<int:id>", methods=['POST'])
61 def bericht_change_date_invalid(id):
62 return BerichtController().change_date_invalid(id)
65 @app.route("/gasthaus/list")
67 return GasthausController().list()
70 @app.route("/gasthaus/view/<int:id>")
71 def gasthaus_view(id):
72 return GasthausController().view(id)
75 @app.route("/gasthaus/update")
76 def gasthaus_update():
77 return GasthausController().update()
80 @app.route("/coordtool/index")
81 def coordtool_index():
82 return CoordtoolController().index()
85 @app.route("/coordtool/convert", methods=['POST'])
86 def coordtool_convert():
87 return CoordtoolController().convert()