Start adding pip setup package requirements (setup.py, __init__.py, use pkg_resource)

This commit is contained in:
Vincent Emonet 2021-02-09 01:24:34 +01:00
parent 9191524c04
commit 90d743796b
7 changed files with 146 additions and 46 deletions

View file

@ -3,6 +3,7 @@ from flask_swagger import swagger
from flask_swagger_ui import get_swaggerui_blueprint
from langdetect import detect_langs
from langdetect import DetectorFactory
from pkg_resources import resource_filename
DetectorFactory.seed = 0 # deterministic
def get_remote_address():
@ -67,7 +68,7 @@ def create_app(char_limit=-1, req_limit=-1, batch_limit=-1, ga_id=None, debug=Fa
@app.route("/")
def index():
return render_template('index.html', gaId=ga_id, frontendTimeout=frontend_timeout)
return render_template(resource_filename('app', 'templates/index.html'), gaId=ga_id, frontendTimeout=frontend_timeout)
@app.route("/languages")
def langs():