stranck-dev #5
2
app.py
2
app.py
|
@ -48,6 +48,8 @@ async def clear_session(request, exception):
|
||||||
async def main_start(*_):
|
async def main_start(*_):
|
||||||
print(">>>>>> main_start <<<<<<")
|
print(">>>>>> main_start <<<<<<")
|
||||||
|
|
||||||
|
app.config.REQUEST_MAX_SIZE = 1024 * 1024 * 5 # 5 MB
|
||||||
|
|
||||||
app.ctx.om = OrderManager()
|
app.ctx.om = OrderManager()
|
||||||
if FILL_CACHE:
|
if FILL_CACHE:
|
||||||
log.info("Filling cache!")
|
log.info("Filling cache!")
|
||||||
|
|
|
@ -45,6 +45,8 @@ async def upload_propic(request, order: Order):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
img = Image.open(BytesIO(body[0].body))
|
img = Image.open(BytesIO(body[0].body))
|
||||||
|
if(img.size[0] > 2048 or img.size[1] > 2048):
|
||||||
|
raise exceptions.BadRequest("Maximum allowed dimensions: 2048x2048")
|
||||||
|
|
||||||
with open(f"res/propic/{fn}_{order.code}_original", "wb") as f:
|
with open(f"res/propic/{fn}_{order.code}_original", "wb") as f:
|
||||||
f.write(body[0].body)
|
f.write(body[0].body)
|
||||||
|
|
Loading…
Reference in New Issue