1 from flask import Flask
 
     2 from flask import render_template
 
     3 from flask import request
 
     4 from flask import abort, redirect, url_for
 
     6 from flask import send_from_directory
 
     8 from logging import Formatter
 
    10 from flask.ext.babel import gettext as _
 
    11 from flask.ext.babel import Babel
 
    13 from config import LANGUAGES
 
    15 LANGUAGE_SELECTED = "de"
 
    16 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None
 
    23     """ToDo: if translation is completed, switch to en """
 
    24     return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
 
    30     return render_template(get_locale() + "/index.html")
 
    34     global LANGUAGE_SELECTED
 
    35     LANGUAGE_SELECTED = "de"
 
    36     return render_template("/de/index.html")
 
    40     global LANGUAGE_SELECTED
 
    41     LANGUAGE_SELECTED = "en"
 
    42     return render_template("/en/index.html")
 
    44 @app.route("/competition")
 
    46     return render_template(get_locale() + "/competition.html", act="competition")
 
    50     return render_template(get_locale() + "/task.html", act="task")
 
    52 @app.route("/submission")
 
    54     return render_template(get_locale() + "/submission.html", act="submission")
 
    56 @app.route("/coursematerial")
 
    58     return render_template(get_locale() + "/coursematerial.html", act="coursematerial")
 
    60 @app.route("/imprint")
 
    62     return render_template(get_locale() + "/imprint.html", act="imprint")
 
    64 @app.route("/privacy")
 
    66     return render_template(get_locale() + "/privacy.html", act="privacy")
 
    69 @app.route(_("/competition-2013"))
 
    70 def competition_2013():
 
    71     return render_template(get_locale() + "/archive/competitions/2013/comptetition_2013.html",
 
    74 @app.route(_("/competition-2014"))
 
    75 def competition_2014():
 
    76     return render_template(get_locale() + "archive/competitions/2014/competition_2014.html",
 
    79 @app.route(_("/dates"))
 
    81     return render_template(get_locale() + "/dates.html",
 
    85 @app.errorhandler(404)
 
    86 def page_not_found(e):
 
    87     return render_template(get_locale() + "/404.html")
 
    89 if __name__ == "__main__":
 
    90     app.run(host='localhost', port=5014, debug=True)