Что-то с фронтом
This commit is contained in:
parent
46f3aa6caf
commit
f2b813300d
5 changed files with 56 additions and 1 deletions
|
@ -1,12 +1,17 @@
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
from starlette.staticfiles import StaticFiles
|
||||||
|
|
||||||
from app.users.chat.router import router as chat_router
|
from app.users.chat.router import router as chat_router
|
||||||
from app.users.router import router as user_router
|
from app.users.router import router as user_router
|
||||||
|
from app.pages.router import router as pages_router
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
app.include_router(chat_router)
|
app.include_router(chat_router)
|
||||||
app.include_router(user_router)
|
app.include_router(user_router)
|
||||||
|
app.include_router(pages_router)
|
||||||
|
|
||||||
|
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
||||||
|
|
||||||
|
|
||||||
@app.get('/')
|
@app.get('/')
|
||||||
|
|
14
app/pages/router.py
Normal file
14
app/pages/router.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from fastapi import APIRouter, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/pages",
|
||||||
|
tags=["Страницы"]
|
||||||
|
)
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="app/templates")
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/base")
|
||||||
|
async def base(request: Request):
|
||||||
|
return templates.TemplateResponse("base.html", {"request": request})
|
36
app/templates/base.html
Normal file
36
app/templates/base.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
{% block head %}{% endblock %}
|
||||||
|
<title>BlackPhoenix</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="flex justify-between text-3xl my-3">
|
||||||
|
<ul>
|
||||||
|
<li class="BpMainButton"><button>Black Phoenix</button></li>
|
||||||
|
<li class="BpMyAccount"><button>Мой аккаунт</button></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul,li{
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.BpMainButton{
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.BpMyAccount{
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</nav>
|
||||||
|
<hr>
|
||||||
|
<div id="content">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -37,5 +37,5 @@ async def get_current_user(token: str = Depends(get_token)):
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
async def validate_user_rights(user: Users = Depends(get_current_user)):
|
async def validate_user_rights(user: Users = Depends(get_current_user)): # Надо дописать
|
||||||
user_rights = UserDAO.get_user_rights()
|
user_rights = UserDAO.get_user_rights()
|
||||||
|
|
Loading…
Add table
Reference in a new issue