Serve static folder

This commit is contained in:
Guillem Borrell 2024-05-17 23:45:35 +02:00
parent 6e347caf50
commit 4930f3c991
3 changed files with 34 additions and 0 deletions

View file

@ -1 +1,2 @@
langchain langchain
fastapi

14
src/hellocomputer/main.py Normal file
View file

@ -0,0 +1,14 @@
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
import hellocomputer
from pathlib import Path
static_path = Path(hellocomputer.__file__).parent / "static"
app = FastAPI()
app.mount(
"/",
StaticFiles(directory=static_path, html=True, packages=["bootstrap4"]),
name="static",
)

View file

@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<body>
<h1>Hello, world!</h1>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
crossorigin="anonymous"></script>
</body>
</html>