removed some debug code, improved comments
This commit is contained in:
parent
569e08e0ac
commit
a64f7efa07
@ -1,8 +1,10 @@
|
|||||||
import os
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from the_works.database import init_db
|
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):
|
def create_app(config=None):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@ -12,7 +14,7 @@ def create_app(config=None):
|
|||||||
|
|
||||||
# some #DEBUG configuration
|
# some #DEBUG configuration
|
||||||
# toolbar = DebugToolbarExtension(app) #DEBUG
|
# 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
|
# use config from function parameter if present
|
||||||
if config:
|
if config:
|
||||||
@ -47,8 +49,8 @@ def create_app(config=None):
|
|||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
# helper function to print formatted file size from https://stackoverflow.com/a/1094933
|
# helper function to print formatted file size; [source](https://stackoverflow.com/a/1094933)
|
||||||
def sizeof_fmt(num, suffix="B"):
|
def sizeof_fmt(num: int, suffix: str = "B") -> str:
|
||||||
if type(num) == "String":
|
if type(num) == "String":
|
||||||
num = int(num)
|
num = int(num)
|
||||||
for unit in ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"):
|
for unit in ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user