Update app.py
Browse files
app.py
CHANGED
@@ -107,13 +107,11 @@ async def update_dashboard(request: Request, userId: str, topic: str, year: str
|
|
107 |
# Return a redirect to the dash app
|
108 |
return RedirectResponse(url="/dash")
|
109 |
|
110 |
-
|
111 |
-
# Fix for venue_redirect endpoint
|
112 |
@app.get("/venue_redirect/{userId}/{topic}/{year}")
|
113 |
@app.get("/venue_redirect/{userId}/{topic}")
|
114 |
async def venue_redirect(request: Request, userId: str, topic: str, year: int = None):
|
115 |
"""
|
116 |
-
A centralized endpoint that redirects to the venue dashboard
|
117 |
"""
|
118 |
try:
|
119 |
# Reset the global venue_dash_app to ensure a fresh instance
|
@@ -127,7 +125,9 @@ async def venue_redirect(request: Request, userId: str, topic: str, year: int =
|
|
127 |
scheme = request.url.scheme # 'http' or 'https'
|
128 |
base_url = f"{scheme}://{request.headers['host']}".rstrip('/')
|
129 |
dashboard_url = f"{base_url}/venues/"
|
130 |
-
|
|
|
|
|
131 |
print(f"Redirecting to {dashboard_url}")
|
132 |
return RedirectResponse(url="/venues/")
|
133 |
except Exception as e:
|
|
|
107 |
# Return a redirect to the dash app
|
108 |
return RedirectResponse(url="/dash")
|
109 |
|
|
|
|
|
110 |
@app.get("/venue_redirect/{userId}/{topic}/{year}")
|
111 |
@app.get("/venue_redirect/{userId}/{topic}")
|
112 |
async def venue_redirect(request: Request, userId: str, topic: str, year: int = None):
|
113 |
"""
|
114 |
+
A centralized endpoint that redirects to the venue dashboard
|
115 |
"""
|
116 |
try:
|
117 |
# Reset the global venue_dash_app to ensure a fresh instance
|
|
|
125 |
scheme = request.url.scheme # 'http' or 'https'
|
126 |
base_url = f"{scheme}://{request.headers['host']}".rstrip('/')
|
127 |
dashboard_url = f"{base_url}/venues/"
|
128 |
+
|
129 |
+
# Don't attempt to open browser through backend when deployed
|
130 |
+
# This is the key change - let the frontend handle redirects instead
|
131 |
print(f"Redirecting to {dashboard_url}")
|
132 |
return RedirectResponse(url="/venues/")
|
133 |
except Exception as e:
|