Repository navigation
Expand file tree
/
Copy pathapp.py
More file actions
60 lines (47 loc) · 1.63 KB
/
Copy pathapp.py
File metadata and controls
60 lines (47 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from flask import redirect, render_template, Flask, session
import json
app = Flask(__name__)
app.config['SECRET_KEY'] = "Secret key for flask app."
texts = json.loads(open('texts.json', 'r').read())
@app.route('/favicon.ico')
def favicon():
return redirect('/static/favicon.ico')
@app.route('/static/<file>')
def sendfile(file):
return app.send_static_file(file)
@app.route("/changelang/<lang>")
def changelang(lang):
langs = ['ru', 'en', 'ua']
if lang in langs:
session['lang'] = lang
return redirect('/')
@app.route('/')
def index():
if not session.get('lang'):
session['lang'] = "en"
lang = session.get('lang')
text1 = texts[lang]['text1']
text2 = texts[lang]['text2']
text3 = texts[lang]['text3']
help = texts[lang]['help']
text4 = texts[lang]['text4']
text5 = texts[lang]['text5']
wbgh = texts[lang]['wbgh']
ubgh = texts[lang]['ubgh']
install = texts[lang]['install']
return render_template('index.html', text1=text1,
text2=text2, text3=text3,
help=help, text4=text4,
text5=text5, wbgh=wbgh,
ubgh=ubgh, install=install)
@app.route('/install')
def install():
lang = session.get('lang')
title = texts[lang]['title']
default = texts[lang]['default']
installed1 = texts[lang]['installed1']
installed2 = texts[lang]['installed2']
return render_template('install.html', title=title, default=default,
installed1=installed1, installed2=installed2)
if __name__ == "__main__":
app.run(debug=True)