Category : uvicorn

import uvicorn app = FastAPI() @app.get("/items/{item_id}") def read_root(item_id: str, request: Request): client_host = request.client.host f= open("ipadress.txt","a+") f.write(client_host+"n") f.close() return {"client_host": client_host, "item_id": item_id} if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", forwarded_allow_ips="*") The above is the python code which is hosted using uvicorn. When I run the code inside a docker container, it returns the correct client ..

Read more

I have a FastAPI app that runs using the uvicorn.run() command. It has been working totally fine until recently, and I have no clue what’s causing it to now fail. The below code works totally fine: uvicorn.run("zyz.app:app", port=8000) However this code: uvicorn.run("zyz.app:app", host="http://localhost", port=8000) receives the below error: ERROR: [Errno -2] Name or service not ..

Read more

I am running gunicorn with uvicorn and fastapi. I see the application is return the following errors somethings (for the majority of calls everything goes well). Error class: fastapi.exceptions:HTTPException Transaction name: starlette.exceptions:ExceptionMiddleware.__call__ First seen:Jul 23 12:58 PM – Last seen:Jul 25 2:40 PM Traceback(most recent call last): File "/usr/local/bin/gunicorn", line 8, in <module> File /usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py, ..

Read more

I design a classification model using Python=3.9.5, Keras=2.4.3 and tensorflow-cpu=2.5.0. The model works fine in the Windows development environment, but when I deploy it to server using Docker, FastAPI and uvicorn. It is stuck at random while adding the first layer. Sometime this error occurs on training for 4th time or sometimes it occurs after ..

Read more