Если в конфиге нет токена для аналитики, то она не будет работать
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled

This commit is contained in:
Данил 2024-10-23 17:01:26 +03:00
parent c9dd20dbb7
commit a08f848d56

View file

@ -1,3 +1,5 @@
import http
import uvicorn import uvicorn
import yaml import yaml
@ -13,7 +15,8 @@ from src.routes import wallpaper
app = FastAPI() app = FastAPI()
app.middleware('http')(PlausibleAnalytics()) if config['analytics']['token']:
app.middleware('http')(PlausibleAnalytics())
app.include_router(index.router) app.include_router(index.router)
app.include_router(wallpaper.router) app.include_router(wallpaper.router)
@ -34,7 +37,7 @@ async def robots_txt():
@app.exception_handler(404) @app.exception_handler(404)
async def not_found(req, __): async def not_found(req, __):
return FileResponse('./src/web/html/error/404.html') return FileResponse('./src/web/html/error/404.html', status_code=http.HTTPStatus.NOT_FOUND)
if __name__ == '__main__': if __name__ == '__main__':
uvicorn.run(app, uvicorn.run(app,