Las configuraciones fueron movidas y cambiadas un poco

This commit is contained in:
Daniel Cortes
2019-02-19 01:38:22 -03:00
parent 2633f84fc7
commit 6e9af8302d
2 changed files with 8 additions and 6 deletions

View File

@@ -7,11 +7,15 @@ def create_app():
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
DATABASE=os.path.join(app.instance_path, 'files.sqlite'),
UPLOAD_FOLDER='uploads'
DATABASE = os.path.join(app.instance_path, 'files.sqlite'),
USERNAME = 'dev',
PASSWORD = 'secret',
SECRET_KEY = '1337',
UPLOAD_FOLDER = 'uploads',
ALLOWED_EXTENSIONS = set(['png', 'jpg'])
)
app.config.from_pyfile('config.py', silent=True)
app.config.from_pyfile('config.py')
app.wsgi_app = SharedDataMiddleware(app.wsgi_app, { '/uploads': app.config['UPLOAD_FOLDER'] })
try:

View File

@@ -6,13 +6,11 @@ from files.auth import admin_required
import random
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'md'])
bp = Blueprint('files', __name__)
bp.add_url_rule('/uploads/<path:filename>', 'uploaded_file', build_only=True)
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
return '.' in filename and filename.rsplit('.', 1)[1].lower() in current_app.config['ALLOWED_EXTENSIONS']
@bp.route('/', methods=['GET', 'POST'])
def index():