File size: 938 Bytes
de37e35 658e692 f5b335c 06ff008 658e692 93da0bc 658e692 93da0bc f5b335c c84994a 658e692 de37e35 f5b335c 06ff008 658e692 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# app.py
from fastapi import FastAPI, Request, HTTPException
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from routes.authentication import auth_router
import os
# Initialize FastAPI app and template directory
app = FastAPI()
templates = Jinja2Templates(directory="templates")
# Mount static files if the directory exists
static_dir = "static"
if os.path.isdir(static_dir):
app.mount("/static", StaticFiles(directory=static_dir), name="static")
else:
raise HTTPException(status_code=500, detail="Static directory not found.")
# Include authentication routes
app.include_router(auth_router, prefix="/auth", tags=["Authentication"])
@app.get("/", response_class=HTMLResponse)
async def landing_page(request: Request):
"""Render the landing page template."""
return templates.TemplateResponse("landing.html", {"request": request})
|