Spaces:
Sleeping
Sleeping
test
Browse files- app/main.py +6 -2
app/main.py
CHANGED
@@ -49,8 +49,12 @@ async def health_check():
|
|
49 |
@app.get("/")
|
50 |
async def home(request: Request):
|
51 |
logger.info("Home page requested")
|
52 |
-
#
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
return templates.TemplateResponse(
|
55 |
"index.html",
|
56 |
{
|
|
|
49 |
@app.get("/")
|
50 |
async def home(request: Request):
|
51 |
logger.info("Home page requested")
|
52 |
+
# Check if we're running in Spaces
|
53 |
+
is_spaces = os.getenv("SPACE_ID") is not None
|
54 |
+
# Use HTTPS only for Spaces, otherwise use the request's protocol
|
55 |
+
base_url = str(request.base_url)
|
56 |
+
if is_spaces:
|
57 |
+
base_url = base_url.replace("http://", "https://")
|
58 |
return templates.TemplateResponse(
|
59 |
"index.html",
|
60 |
{
|