Add size limit
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
MAX_CONTENT_LENGTH=1048576
|
||||||
MAX_PENDING_TIME=600
|
MAX_PENDING_TIME=600
|
||||||
MAX_STORE_TIME=259200
|
MAX_STORE_TIME=259200
|
||||||
FLASK_DEBUG=0
|
FLASK_DEBUG=0
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ app: Flask = Flask(__name__)
|
|||||||
app.json.sort_keys = False # type: ignore
|
app.json.sort_keys = False # type: ignore
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DB_URI")
|
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DB_URI")
|
||||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||||
|
app.config["MAX_CONTENT_LENGTH"] = os.environ.get("MAX_CONTENT_LENGTH")
|
||||||
RESULT_FOLDER.mkdir(parents=True, exist_ok=True)
|
RESULT_FOLDER.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +30,11 @@ redis_conn = Redis(host="redis", port=6379)
|
|||||||
queue = Queue(connection=redis_conn)
|
queue = Queue(connection=redis_conn)
|
||||||
|
|
||||||
|
|
||||||
|
@app.errorhandler(413)
|
||||||
|
def too_large(e):
|
||||||
|
return jsonify({"error": "Image size exceeded"}), 413
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index() -> str:
|
def index() -> str:
|
||||||
"""Render the main index page."""
|
"""Render the main index page."""
|
||||||
|
|||||||
Reference in New Issue
Block a user