From 71504b8fbf84a02f169f84fc1b782a495ab0d780 Mon Sep 17 00:00:00 2001 From: Medvedev Stanislav Date: Sun, 9 Jun 2024 21:37:21 +0300 Subject: init --- .gitignore | 2 ++ app/__init__.py | 0 app/main.py | 12 ++++++++++++ readme.md | 0 requirements.txt | 3 +++ templates/index.html | 11 +++++++++++ 6 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 app/__init__.py create mode 100644 app/main.py create mode 100644 readme.md create mode 100644 requirements.txt create mode 100644 templates/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d75edea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv +__pycache__ \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..1c4590e --- /dev/null +++ b/app/main.py @@ -0,0 +1,12 @@ +from fastapi import FastAPI, Request +from fastapi.responses import HTMLResponse +from starlette.templating import Jinja2Templates + +app = FastAPI() + +templates = Jinja2Templates(directory="templates") + + +@app.get("/", response_class=HTMLResponse) +async def read_root(request: Request): + return templates.TemplateResponse("index.html", {"request": request}) diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f33c653 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +fastapi==0.111.0 +uvicorn==0.30.1 +jinja2==3.1.4 \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..c254629 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + + Привет мир + + \ No newline at end of file -- cgit v1.2.3