24 lines
571 B
Python
24 lines
571 B
Python
from flask import Flask, render_template, request
|
|
import json
|
|
import validator
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/validator', methods=['GET', 'POST'])
|
|
def validate():
|
|
if request.method == 'POST':
|
|
print(request.files)
|
|
f = request.files['file']
|
|
|
|
text = validator.process_file(f)
|
|
result = validator.validate(text)
|
|
return jsonify(result)
|
|
else:
|
|
return 'Soubor byl zvalidován. TODO musím ověřit, jak byl zvalidován.' # TODO change
|
|
|
|
|
|
app.run() |