INNER CODE UNIT · Python

mount_static_files

derisk-ai/OpenDerisk · packages/derisk-app/src/derisk_app/app.py:208

def mount_static_files(app: FastAPI, param: ApplicationConfig):
    if param.service.web.new_web_ui:
        static_file_path = os.path.join(ROOT_PATH, "src", "derisk_app/static/web")
    else:
        static_file_path = os.path.join(ROOT_PATH, "src", "derisk_app/static/old_web")

    os.makedirs(STATIC_MESSAGE_IMG_PATH, exist_ok=True)
    app.mount(
        "/images",
        WebSocketAwareStaticFiles(directory=STATIC_MESSAGE_IMG_PATH, html=True),
        name="static2",
    )
    app.mount(
        "/",
        WebSocketAwareStaticFiles(directory=static_file_path, html=True),
        name="static",
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…