diff --git a/src/TranslationServer.py b/src/TranslationServer.py index f0127cf..29497b2 100644 --- a/src/TranslationServer.py +++ b/src/TranslationServer.py @@ -4,6 +4,7 @@ from flask import Flask, request, send_file, abort from functools import wraps from PortGlosa import traduzir +from subprocess import check_output import os, argparse RUN_MODE=None @@ -47,7 +48,7 @@ def init_mode(args): print "# Server started in dictionary mode. Requests will be accepted for translation of texts and download bundles.\n# Endpoints '/translate' and '/sign' are available." elif RUN_MODE == "full": full_mode() - print "# Server started in full mode. Requests will be accepted for translation of texts, download bundles. All bundles requests will be stored in a database.\n# Endpoints '/translate', '/sign' are available." + print "# Server started in full mode. Requests will be accepted for translation of texts, download bundles. All bundles requests will be stored in a database.\n# Endpoints '/translate', '/sign' and '/statistics' are available." elif RUN_MODE == "translate": print "# Server started in translation mode.\n# Only endpoint '/translate' available." @@ -106,6 +107,12 @@ def translate(): text = request.args.get('text').encode("UTF-8") return traduzir(text) +@app.route("/statistics") +def load_statistics_page(): + page_path = os.path.join(app.static_folder, "statistics") + php_output = check_output(["php", page_path]) + return php_output + @app.route("/sign", methods=['GET']) @check_run_mode def get_sign(): @@ -120,4 +127,4 @@ if __name__ == "__main__": parser.add_argument("--mode", help="Video title", default="translate") args = parser.parse_args() init_mode(args) - app.run(host="0.0.0.0", port=int(args.port), threaded=True, debug=False) \ No newline at end of file + app.run(host="0.0.0.0", port=int(args.port), threaded=True, debug=False) -- libgit2 0.21.2