Las configuraciones fueron movidas y cambiadas un poco
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user