-
Notifications
You must be signed in to change notification settings - Fork 49
/
run_syn.py
executable file
·41 lines (26 loc) · 910 Bytes
/
run_syn.py
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
#!/usr/bin/env python3
# coding: utf-8
from flask import Flask, url_for, send_from_directory
from lang_converter import LangConverter
from webvectors import *
import configparser
import config_path
config = configparser.RawConfigParser()
config.read(config_path.CONFIG)
url = config.get("Other", "url")
app_syn = Flask(__name__, static_url_path="/data/")
@app_syn.route(url + "data/<path:query>")
def send_js(query):
return send_from_directory("data/", query)
app_syn.url_map.converters["lang"] = LangConverter
app_syn.register_blueprint(wvectors)
@app_syn.context_processor
def set_globals():
return dict(lang=g.lang, strings=g.strings)
def url_for_other_page(page):
args = request.view_args.copy()
args["page"] = page
return url_for(request.endpoint, **args)
app_syn.jinja_env.globals["url_for_other_page"] = url_for_other_page
if __name__ == "__main__":
app_syn.run()