Example #1
0
from flask import Flask
import os

app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file__))

app.config.from_object("app.config")
app.config["MAX_CONTENT_LENGTH"] = 16 * 1024 * 1024  # 16 MB file-size limit
app.config["UPLOAD_FOLDER"] = os.path.join(basedir, "static")
app.config["BACKUP_FOLDER"] = os.path.join(basedir, "static/backups")


app.config["SECRET_KEY"] = "abracadabara"

from app import views
Example #2
0
import os, os.path, json, datetime
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, make_response
from werkzeug import secure_filename
from app.rxparse import process_pricetable, process_formulary, process_usermatches

UPLOAD_FOLDER = "app/input"
PERSISTENT_FOLDER = "app/persistent"
BACKUP_FOLDER = "app/markdown-backup"
OUTPUT_FOLDER = "app/output"
ALLOWED_EXTENSIONS = set(["txt", "xls", "xlsx", "csv", "tsv", "md", "markdown"])
PERSISTENT_PRICETABLE_FILENAME = "persistent-pricetable.tsv"

app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
app.config["PERSISTENT_FOLDER"] = PERSISTENT_FOLDER
app.config["BACKUP_FOLDER"] = BACKUP_FOLDER
app.config["OUTPUT_FOLDER"] = OUTPUT_FOLDER
app.config["MAX_CONTENT_LENGTH"] = 100 * 1024 * 1024  # Set max upload file size to 100mb


def json_encode_set(obj):
    if isinstance(obj, set):
        return list(obj)
    raise TypeError


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


@app.route("/")