Example #1
0
import os

from decimal import Decimal
from flask import Flask, render_template, request, send_from_directory
from werkzeug.utils import secure_filename

from scripts.varita import process
from scripts.mg_g_muestra import invert_table

app = Flask(__name__)

UPLOAD_FOLDER = "/tmp"
ALLOWED_EXTENSIONS = ["csv"]
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
app.config["RESULT_FOLDER"] = UPLOAD_FOLDER

# app.debug = True


def allowed_file(filename):
    return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS


@app.route("/", methods=["POST", "GET"])
def home():
    if request.method == "GET":
        return render_template("home.html")
    else:
        # POST request
        form = request.form
        f = request.files["csv"]