Compare commits
No commits in common. "1fa64feefc62f8d0dd6dbe929c879c495f197a5d" and "0b4322d671838f7659957a04a1ebc9c24cc7eb2b" have entirely different histories.
1fa64feefc
...
0b4322d671
10
app/main.py
10
app/main.py
@ -6,8 +6,7 @@ from typing import Annotated, Optional, Union
|
||||
|
||||
import geoip2.database
|
||||
from geoip2.errors import AddressNotFoundError
|
||||
from fastapi import FastAPI, Path, Body, Request, Response, status
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi import FastAPI, Path, Body, Response, status
|
||||
from pydantic import BaseModel
|
||||
|
||||
app = FastAPI()
|
||||
@ -88,10 +87,3 @@ async def root_get(ipaddress: Annotated[Union[IPv4Address,IPv6Address],
|
||||
return locations.pop()
|
||||
response.status_code = status.HTTP_404_NOT_FOUND
|
||||
return GeoLocation()
|
||||
|
||||
@app.get("/")
|
||||
def root_redirect(req: Request) -> RedirectResponse:
|
||||
'''
|
||||
Redirect empty request using REMOTE_ADDR
|
||||
'''
|
||||
return RedirectResponse(url= str(req.url) + str(req.client.host))
|
||||
|
24
start.sh
24
start.sh
@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME=ismijnipverweg
|
||||
DIR=/opt/apps/ismijnipverweg/app
|
||||
USER=www
|
||||
GROUP=nobody
|
||||
WORKERS=3
|
||||
WORKER_CLASS=uvicorn.workers.UvicornWorker
|
||||
#VENV=$DIR/.venv/bin/activate
|
||||
BIND=unix:$DIR/../run/gunicorn.sock
|
||||
LOG_LEVEL=debug
|
||||
|
||||
cd $DIR
|
||||
# source $VENV
|
||||
|
||||
exec gunicorn main:app \
|
||||
--name $NAME \
|
||||
--workers $WORKERS \
|
||||
--worker-class $WORKER_CLASS \
|
||||
--user=$USER \
|
||||
--group=$GROUP \
|
||||
--bind=$BIND \
|
||||
--log-level=$LOG_LEVEL \
|
||||
--log-file=-
|
Loading…
x
Reference in New Issue
Block a user