commit 9e2e759a7e39ec4bcf0af3c9dcda81538a7d8451 Author: sunbeam Date: Mon Dec 30 17:03:58 2024 +0800 初步OK diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/main.py b/main.py new file mode 100644 index 0000000..5e929d7 --- /dev/null +++ b/main.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI +from fastapi.staticfiles import StaticFiles + +app = FastAPI() + + +app.mount("/", StaticFiles(directory="./web", html=True)) + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="0.0.0.0", port=8000) \ No newline at end of file diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..697fc76 --- /dev/null +++ b/web/index.html @@ -0,0 +1,12 @@ + + + + + + FastAPI Example + + +

Hello, FastAPI!

+

This is an example of loading an HTML file using FastAPI.

+ + \ No newline at end of file