Spaces:
Running
Running
Create main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# main.py — single ASGI app (stable Shiny mount)
|
| 2 |
+
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
from shiny.asgi import ShinyApp
|
| 5 |
+
import shiny.express as sx # import the package, not the submodule
|
| 6 |
+
|
| 7 |
+
from Deployment_UI import router as deployment_ui_router
|
| 8 |
+
from Deployment_UI_BE import router as deployment_be_router
|
| 9 |
+
|
| 10 |
+
app = FastAPI()
|
| 11 |
+
app.include_router(deployment_ui_router) # serves /Deployment_UI
|
| 12 |
+
app.include_router(deployment_be_router) # serves /api/...
|
| 13 |
+
|
| 14 |
+
# Mount Shiny Express at /
|
| 15 |
+
# Wrap the Shiny app with the ASGI adapter (prevents “module not callable”
|
| 16 |
+
# and avoids the submodule import that led to the hex/int ‘path’ error)
|
| 17 |
+
app.mount("/", ShinyApp(sx.app))
|