diff --git a/app/common.py b/app/common.py index 2adf0f8..112db25 100644 --- a/app/common.py +++ b/app/common.py @@ -22,6 +22,7 @@ class Settings(BaseSettings): session_key: str = secrets.token_hex(32) csrf_key: str = secrets.token_hex(32) + settings = Settings() diff --git a/app/forms/__init__.py b/app/forms/__init__.py index e078afd..d6e76a9 100644 --- a/app/forms/__init__.py +++ b/app/forms/__init__.py @@ -25,5 +25,5 @@ async def get_form( Returns: StarletteForm instance """ - + return await form.from_formdata(request=req) diff --git a/app/paths/__init__.py b/app/paths/__init__.py index 16d789d..b373f12 100644 --- a/app/paths/__init__.py +++ b/app/paths/__init__.py @@ -17,7 +17,7 @@ class Paths(abc.ABC): """ self.app = app - + @abc.abstractmethod def add_paths(self) -> None: """Add paths to the FastAPI application""" diff --git a/app/paths/errors.py b/app/paths/errors.py index 8acad5a..d92766b 100644 --- a/app/paths/errors.py +++ b/app/paths/errors.py @@ -23,7 +23,7 @@ class ErrorsPaths(Paths): # For each HTTP code specified above for code in codes: self.add_handler(code) - + def add_handler(self, code: int) -> None: """Adds an error handler to FastAPI app. Only for internal use! diff --git a/app/paths/table.py b/app/paths/table.py index f1c7481..e74f9cf 100644 --- a/app/paths/table.py +++ b/app/paths/table.py @@ -51,7 +51,7 @@ class TablePaths(Paths): if form.pswd.data != '1234': return respond.with_text('Incorrect password') - + crud.create_user( db=db_s, user=schemas.UserCreate( diff --git a/app/respond.py b/app/respond.py index 51bd00e..7635abf 100644 --- a/app/respond.py +++ b/app/respond.py @@ -135,7 +135,7 @@ def with_file( return FileResponse( path=path, media_type=( - mime or + mime or mimetypes.guess_type(path)[0] ), status_code=code, diff --git a/app/sql/db.py b/app/sql/db.py index 5e78972..489e2f2 100644 --- a/app/sql/db.py +++ b/app/sql/db.py @@ -17,6 +17,7 @@ class SqlSettings(BaseSettings): db_password: str = '' db_database: str = '${REPO_NAME_SNAKE}' + sql_settings = SqlSettings() # DB connection URL