pymove3d.py
author Reimar Bauer <rb.proj AT googlemail DOT com>
Sat, 18 Jan 2014 10:06:48 +0100
changeset 99 98360a0a7797
parent 97 9fa249552dba
child 100 fbc07ac77baa
permissions -rwxr-xr-x
reorganized theme and translations
peter@1
     1
from flask import Flask
peter@1
     2
from flask import render_template
peter@1
     3
from flask import request
peter@1
     4
from flask import abort, redirect, url_for
peter@1
     5
import os
peter@1
     6
from flask import send_from_directory
peter@1
     7
import logging
peter@1
     8
from logging import Formatter
peter@1
     9
rb@95
    10
from flask.ext.babel import gettext as _
peter@1
    11
from flask.ext.babel import Babel
peter@1
    12
rb@95
    13
from config import LANGUAGES
rb@95
    14
rb@95
    15
peter@1
    16
app = Flask(__name__)
peter@1
    17
babel = Babel(app)
peter@1
    18
peter@1
    19
@babel.localeselector
peter@1
    20
def get_locale():
rb@95
    21
    return request.accept_languages.best_match(LANGUAGES.keys())
peter@1
    22
peter@1
    23
@app.route("/")
peter@1
    24
rb@95
    25
@app.route(_("/index"))
peter@1
    26
def index():
rb@95
    27
    return render_template(_("en/index.html"))
peter@1
    28
rb@95
    29
@app.route(_("/competition"))
peter@1
    30
def competition():
rb@95
    31
    return render_template(_("en/competition.html"), act="competition")
peter@1
    32
rb@95
    33
@app.route(_("/task"))
peter@1
    34
def task():
rb@95
    35
    return render_template(_("en/task.html"), act="task")
peter@1
    36
rb@95
    37
@app.route(_("/submission"))
peter@1
    38
def submission():
rb@95
    39
    return render_template(_("en/submission.html"), act="submission")
peter@1
    40
rb@95
    41
@app.route(_("/coursematerial"))
peter@1
    42
def coursematerial():
rb@95
    43
    return render_template(_("en/coursematerial.html"), act="coursematerial")
peter@1
    44
rb@95
    45
@app.route(_("/imprint"))
peter@88
    46
def imprint():
rb@95
    47
    return render_template(_("en/imprint.html"), act="imprint")
peter@88
    48
rb@95
    49
@app.route(_("/privacy"))
peter@88
    50
def privacy():
rb@95
    51
    return render_template(_("en/privacy.html"), act="privacy")
peter@88
    52
peter@88
    53
peter@1
    54
@app.errorhandler(404)
peter@1
    55
def page_not_found(e):
rb@97
    56
    return render_template(_("en/404.html")), 404
peter@1
    57
peter@1
    58
if __name__ == "__main__":
peter@1
    59
    app.run(host='localhost', port=5014, debug=True)
peter@1
    60
peter@1
    61
Impressum Datenschutzerklärung