diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | app/__init__.py | 0 | ||||
-rw-r--r-- | app/main.py | 12 | ||||
-rw-r--r-- | readme.md | 0 | ||||
-rw-r--r-- | requirements.txt | 3 | ||||
-rw-r--r-- | templates/index.html | 11 |
6 files changed, 28 insertions, 0 deletions
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 --- /dev/null +++ b/app/__init__.py 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 --- /dev/null +++ b/readme.md 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 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Document</title> +</head> +<body> + Привет мир +</body> +</html>
\ No newline at end of file |