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@88
|
42 |
@app.route("/imprint")
|
peter@88
|
43 |
def imprint():
|
peter@88
|
44 |
return render_template("imprint.html", act="imprint")
|
peter@88
|
45 |
|
peter@90
|
46 |
@app.route("/privacy")
|
peter@88
|
47 |
def privacy():
|
peter@88
|
48 |
return render_template("privacy.html", act="privacy")
|
peter@88
|
49 |
|
peter@88
|
50 |
|
peter@1
|
51 |
@app.errorhandler(404)
|
peter@1
|
52 |
def page_not_found(e):
|
peter@1
|
53 |
return render_template("404.html"), 404
|
peter@1
|
54 |
|
peter@1
|
55 |
if __name__ == "__main__":
|
peter@1
|
56 |
app.run(host='localhost', port=5014, debug=True)
|
peter@1
|
57 |
|
peter@1
|
58 |
|