import logging from argparse import ArgumentParser from os import makedirs from pathlib import Path from fastapi.responses import FileResponse from modules.app import app from modules.extensions_loader import dynamic_import_from_src from modules.migrator import migrate_database from modules.scheduler import scheduler makedirs(Path("data/users"), exist_ok=True) logging.basicConfig( level=logging.INFO, format="%(name)s.%(funcName)s | %(levelname)s | %(message)s", datefmt="[%X]", ) @app.get("/favicon.ico", response_class=FileResponse, include_in_schema=False) async def favicon(): return FileResponse("favicon.ico") # ================================================================================= dynamic_import_from_src("extensions", star_import=True) # ================================================================================= scheduler.start() parser = ArgumentParser( prog="PhotosAPI", description="Small and simple API server for saving photos and videos.", ) parser.add_argument("--migrate", action="store_true") args, unknown = parser.parse_known_args() if args.migrate: migrate_database()