Spaces:
Runtime error
Runtime error
Commit
·
a336494
1
Parent(s):
9300a94
router issue
Browse files- backend/app.py +7 -7
backend/app.py
CHANGED
|
@@ -52,13 +52,6 @@ app.add_middleware(
|
|
| 52 |
allow_headers=["*"],
|
| 53 |
)
|
| 54 |
|
| 55 |
-
# Serve the React frontend if available
|
| 56 |
-
frontend_path = "/app/frontend/build"
|
| 57 |
-
if os.path.exists(frontend_path):
|
| 58 |
-
app.mount("/", StaticFiles(directory=frontend_path, html=True), name="frontend")
|
| 59 |
-
else:
|
| 60 |
-
print(f"Warning: Frontend build directory '{frontend_path}' does not exist.")
|
| 61 |
-
|
| 62 |
# Create a router for the API endpoints
|
| 63 |
router = APIRouter()
|
| 64 |
|
|
@@ -149,6 +142,13 @@ async def return_state_data_endpoint(
|
|
| 149 |
# Include the router with a prefix, making endpoints accessible under /api
|
| 150 |
app.include_router(router, prefix="/api")
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
if __name__ == "__main__":
|
| 153 |
import uvicorn
|
| 154 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 52 |
allow_headers=["*"],
|
| 53 |
)
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Create a router for the API endpoints
|
| 56 |
router = APIRouter()
|
| 57 |
|
|
|
|
| 142 |
# Include the router with a prefix, making endpoints accessible under /api
|
| 143 |
app.include_router(router, prefix="/api")
|
| 144 |
|
| 145 |
+
# Serve the React frontend if available
|
| 146 |
+
frontend_path = "/app/frontend/build"
|
| 147 |
+
if os.path.exists(frontend_path):
|
| 148 |
+
app.mount("/", StaticFiles(directory=frontend_path, html=True), name="frontend")
|
| 149 |
+
else:
|
| 150 |
+
print(f"Warning: Frontend build directory '{frontend_path}' does not exist.")
|
| 151 |
+
|
| 152 |
if __name__ == "__main__":
|
| 153 |
import uvicorn
|
| 154 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|