author | stetrabby <info@trabucchi.de> |
Sun, 29 Dec 2013 12:41:43 +0100 | |
changeset 60 | 152e56840f49 |
parent 3 | c07ffbab8647 |
child 34 | d9a3c0cebf6b |
child 88 | 73dea50cd9c5 |
permissions | -rwxr-xr-x |
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 |
|
peter@1 | 10 |
from flask.ext.babel import gettext |
peter@1 | 11 |
from flask.ext.babel import Babel |
peter@1 | 12 |
|
peter@1 | 13 |
app = Flask(__name__) |
peter@1 | 14 |
babel = Babel(app) |
peter@1 | 15 |
|
peter@1 | 16 |
@babel.localeselector |
peter@1 | 17 |
def get_locale(): |
peter@1 | 18 |
return "en" #request.accept_languages.best_match(LANGUAGES.keys()) |
peter@1 | 19 |
|
peter@1 | 20 |
@app.route("/") |
peter@1 | 21 |
|
peter@1 | 22 |
@app.route("/index") |
peter@1 | 23 |
def index(): |
peter@3 | 24 |
return render_template("index.html") |
peter@1 | 25 |
|
peter@1 | 26 |
@app.route("/competition") |
peter@1 | 27 |
def competition(): |
peter@1 | 28 |
return render_template("competition.html", act="competition") |
peter@1 | 29 |
|
peter@1 | 30 |
@app.route("/task") |
peter@1 | 31 |
def task(): |
peter@1 | 32 |
return render_template("task.html", act="task") |
peter@1 | 33 |
|
peter@1 | 34 |
@app.route("/submission") |
peter@1 | 35 |
def submission(): |
peter@1 | 36 |
return render_template("submission.html", act="submission") |
peter@1 | 37 |
|
peter@1 | 38 |
@app.route("/coursematerial") |
peter@1 | 39 |
def coursematerial(): |
peter@1 | 40 |
return render_template("coursematerial.html", act="coursematerial") |
peter@1 | 41 |
|
peter@1 | 42 |
@app.errorhandler(404) |
peter@1 | 43 |
def page_not_found(e): |
peter@1 | 44 |
return render_template("404.html"), 404 |
peter@1 | 45 |
|
peter@1 | 46 |
if __name__ == "__main__": |
peter@1 | 47 |
app.run(host='localhost', port=5014, debug=True) |
peter@1 | 48 |
|
peter@1 | 49 |