mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-21 16:26:21 +03:00
Если в конфиге нет токена для аналитики, то она не будет работать
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
c9dd20dbb7
commit
a08f848d56
1 changed files with 5 additions and 2 deletions
7
main.py
7
main.py
|
@ -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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue