From 4930f3c991c5bdea7574a4cef2ddb4b296f51d53 Mon Sep 17 00:00:00 2001 From: Guillem Borrell Date: Fri, 17 May 2024 23:45:35 +0200 Subject: [PATCH] Serve static folder --- requirements.in | 1 + src/hellocomputer/main.py | 14 ++++++++++++++ src/hellocomputer/static/index.html | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/hellocomputer/main.py create mode 100644 src/hellocomputer/static/index.html diff --git a/requirements.in b/requirements.in index 98cef79..8048479 100644 --- a/requirements.in +++ b/requirements.in @@ -1 +1,2 @@ langchain +fastapi diff --git a/src/hellocomputer/main.py b/src/hellocomputer/main.py new file mode 100644 index 0000000..cb42d15 --- /dev/null +++ b/src/hellocomputer/main.py @@ -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", +) diff --git a/src/hellocomputer/static/index.html b/src/hellocomputer/static/index.html new file mode 100644 index 0000000..4b17aa0 --- /dev/null +++ b/src/hellocomputer/static/index.html @@ -0,0 +1,19 @@ + + + + + + + Bootstrap demo + + + + +

Hello, world!

+ + + + \ No newline at end of file