pymove3d.py
author stetrabby <info@trabucchi.de>
Sat, 18 Jan 2014 12:34:36 +0100
changeset 114 6093dda9fe38
parent 112 61b346446ea7
child 118 8f3447e7f36e
permissions -rwxr-xr-x
front-page main content changed
     1 from flask import Flask
     2 from flask import render_template
     3 from flask import request
     4 from flask import abort, redirect, url_for
     5 import os
     6 from flask import send_from_directory
     7 import logging
     8 from logging import Formatter
     9 
    10 from flask.ext.babel import gettext as _
    11 from flask.ext.babel import Babel
    12 
    13 from config import LANGUAGES
    14 
    15 
    16 app = Flask(__name__)
    17 babel = Babel(app)
    18 
    19 @babel.localeselector
    20 def get_locale():
    21     """ToDo: if translation is completed, switch to en """
    22     return request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
    23 
    24 
    25 @app.route("/")
    26 
    27 @app.route("/index")
    28 def index():
    29     return render_template(get_locale() + "/index.html")
    30 
    31 @app.route("/competition")
    32 def competition():
    33     return render_template(get_locale() + "/competition.html", act="competition")
    34 
    35 @app.route("/task")
    36 def task():
    37     return render_template(get_locale() + "/task.html", act="task")
    38 
    39 @app.route("/submission")
    40 def submission():
    41     return render_template(get_locale() + "/submission.html", act="submission")
    42 
    43 @app.route("/coursematerial")
    44 def coursematerial():
    45     return render_template(get_locale() + "/coursematerial.html", act="coursematerial")
    46 
    47 @app.route("/imprint")
    48 def imprint():
    49     return render_template(get_locale() + "/imprint.html", act="imprint")
    50 
    51 @app.route("/privacy")
    52 def privacy():
    53     return render_template(get_locale() + "/privacy.html", act="privacy")
    54 
    55 
    56 @app.route(_("/competition-2013"))
    57 def competition_2013():
    58     return render_template(get_locale() + "/archive/competitions/2013/comptetition_2013.html",
    59                            act="coursematerial")
    60 
    61 @app.route(_("/competition-2014"))
    62 def competition_2014():
    63     return render_template(get_locale() + "archive/competitions/2014/competition_2014.html",
    64                            act="coursematerial")
    65 
    66 @app.route(_("/dates"))
    67 def dates():
    68     return render_template(get_locale() + "/dates.html",
    69                            act="dates")
    70 
    71 
    72 @app.errorhandler(404)
    73 def page_not_found(e):
    74     return render_template(get_locale() + "/404.html")
    75 
    76 if __name__ == "__main__":
    77     app.run(host='localhost', port=5014, debug=True)
    78 
    79 
Impressum Datenschutzerklärung