removed some debug code, improved comments

This commit is contained in:
eclipse 2025-07-17 21:21:21 +02:00
parent 569e08e0ac
commit a64f7efa07

View File

@ -1,8 +1,10 @@
import os
from dotenv import load_dotenv
from flask import Flask
from the_works.database import init_db
from flask_debugtoolbar import DebugToolbarExtension
# this import is not strictly necessary but it forces pipreqs-to include dotenv when generating `requirements.txt`
import dotenv
#from flask_debugtoolbar import DebugToolbarExtension
def create_app(config=None):
app = Flask(__name__)
@ -12,7 +14,7 @@ def create_app(config=None):
# some #DEBUG configuration
# toolbar = DebugToolbarExtension(app) #DEBUG
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False #DEBUG
# app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False #DEBUG
# use config from function parameter if present
if config:
@ -47,8 +49,8 @@ def create_app(config=None):
return app
# helper function to print formatted file size from https://stackoverflow.com/a/1094933
def sizeof_fmt(num, suffix="B"):
# helper function to print formatted file size; [source](https://stackoverflow.com/a/1094933)
def sizeof_fmt(num: int, suffix: str = "B") -> str:
if type(num) == "String":
num = int(num)
for unit in ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"):