diff --git a/app.py b/app.py index 2633634..4a74756 100644 --- a/app.py +++ b/app.py @@ -176,4 +176,4 @@ async def logour(request): raise exceptions.Forbidden("You have been logged out.") if __name__ == "__main__": - app.run(host="0.0.0.0", port=8188, dev=DEV_MODE) + app.run(host="0.0.0.0", port=8188, dev=DEV_MODE, access_log=ACCESS_LOG) diff --git a/config.example.py b/config.example.py index 77cece6..d2b3985 100644 --- a/config.example.py +++ b/config.example.py @@ -16,6 +16,8 @@ FILL_CACHE = True CACHE_EXPIRE_TIME = 60 * 60 * 4 DEV_MODE = True +ACCESS_LOG = True +EXTRA_PRINTS = True # Metadata property for item-id mapping METADATA_NAME = "item_name" diff --git a/propic.py b/propic.py index de1d85f..64f72e3 100644 --- a/propic.py +++ b/propic.py @@ -12,7 +12,7 @@ bp = Blueprint("propic", url_prefix="/manage/propic") async def resetDefaultPropic(request, order: Order, isFursuiter, sendAnswer=True): s = "_fursuiter" if isFursuiter else "" - if (DEV_MODE): + if (EXTRA_PRINTS): print("Resetting {fn} picture for {orderCod}".format(fn="Badge" if not isFursuiter else "fursuit", orderCod = order.code)) with open("res/propic/default.png", "rb") as f: data = f.read() @@ -100,7 +100,7 @@ async def upload_propic(request, order: Order): await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}.jpg', 'image/jpeg', imgBytes) except Exception: import traceback - if DEV_MODE: print(traceback.format_exc()) + if EXTRA_PRINTS: print(traceback.format_exc()) raise exceptions.BadRequest(errorDetails if errorDetails else "The image you uploaded is not valid.") else: await order.edit_answer(fn, f"{fn}_{order.code}.jpg") diff --git a/utils.py b/utils.py index 211a994..50427fc 100644 --- a/utils.py +++ b/utils.py @@ -73,7 +73,7 @@ async def loadItems(): categoryName = checkAndGetCategory ('item', q) if not categoryName: continue CATEGORIES_LIST_MAP[categoryName].append(q['id']) - if (DEV_MODE): + if (EXTRA_PRINTS): print (f'Mapped Items:') print (ITEMS_ID_MAP) print (f'Mapped Variations:') @@ -86,13 +86,13 @@ async def loadItems(): # Tries to get an item name from metadata. Prints a warning if an item has no metadata def checkAndGetName(type, q): itemName = extractMetadataName(q) - if not itemName and DEV_MODE: + if not itemName and EXTRA_PRINTS: print (type + ' ' + q['id'] + ' has not been mapped.') return itemName def checkAndGetCategory (type, q): categoryName = extractCategory (q) - if not categoryName and DEV_MODE: + if not categoryName and EXTRA_PRINTS: print (type + ' ' + q['id'] + ' has no category set.') return categoryName