Update
This commit is contained in:
parent
d7b9f15936
commit
f7f2c99ee9
|
@ -5,7 +5,7 @@ import uuid
|
|||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI, Request, HTTPException
|
||||
from fastapi.responses import HTMLResponse, JSONResponse
|
||||
from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
|
@ -70,6 +70,12 @@ async def index(request: Request):
|
|||
return response
|
||||
|
||||
|
||||
@app.get("/robots.txt", response_class=PlainTextResponse)
|
||||
def robots():
|
||||
data = """User-agent: *\nAllow: /\nSitemap: /sitemap.xml"""
|
||||
return data
|
||||
|
||||
|
||||
@app.exception_handler(HTTPException)
|
||||
async def http_exception_handler(request, exc):
|
||||
return JSONResponse(status_code=exc.status_code, content={"detail": exc.detail})
|
||||
|
|
|
@ -10,8 +10,6 @@ from fastapi import (
|
|||
# Request,
|
||||
)
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.responses import PlainTextResponse
|
||||
|
||||
|
||||
from .repository import DatingRepository
|
||||
from .schemas import SDating, SDatingAdd, SDatingId
|
||||
|
@ -72,8 +70,3 @@ async def add_dating(dating: SDatingAdd = Body()) -> JSONResponse:
|
|||
# response.set_cookie(key="fakesession", value="fake-cookie-session-value")
|
||||
# return response
|
||||
|
||||
|
||||
@router.get("/robots.txt", response_class=PlainTextResponse)
|
||||
def robots():
|
||||
data = """User-agent: *\nAllow: /\nSitemap: https://lerafoxqueen.ru/sitemap.xml"""
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue