Updated Dockerfile

This commit is contained in:
lkrsnik 2023-12-06 16:35:15 +01:00
parent e71d656d0e
commit ab66eeb6e8
2 changed files with 217 additions and 213 deletions

View File

@ -5,4 +5,4 @@ RUN pip install --upgrade pip
RUN pip install waitress RUN pip install waitress
RUN pip install . RUN pip install .
CMD ["waitress-serve", "--call", "app:app"] CMD ["waitress-serve", "--call", "app:create_app"]

10
app.py
View File

@ -9,16 +9,17 @@ import time
import requests import requests
from flask import Flask, render_template, request, send_file, redirect, url_for from flask import Flask, render_template, request, send_file, redirect, url_for
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
from stark import run from stark import run
app = Flask(__name__)
UPLOAD_FOLDER = 'uploads' UPLOAD_FOLDER = 'uploads'
ALLOWED_EXTENSIONS = {'conllu'} ALLOWED_EXTENSIONS = {'conllu'}
DAYS_BEFORE_DELETION = 1 DAYS_BEFORE_DELETION = 1
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def create_app():
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def create_default_configs(): def create_default_configs():
configs = {} configs = {}
# mandatory parameters # mandatory parameters
@ -258,6 +259,9 @@ def index():
# return render_template('index.html') # return render_template('index.html')
return render_template('index.html') return render_template('index.html')
return app
if __name__ == '__main__': if __name__ == '__main__':
app = create_app()
app.run(debug=True) app.run(debug=True)