I’ve started the deployment of a FastAPI Python app, but it doesn’t seem to finish.
The logs say that the server is up and running:
I can also make calls to the API but a response never seems to come, the request is processed infinitely.
What could the problem be? If you need any more details, I’ll be glad to provide!
I ran into this a few months ago and solved it like this:
I use a shell script that runs uvicorn for my FastAPI app on render. You have to use port 10000 AND 0.0.0.0 for host, which isn’t documented anywhere but some examples.
Here’s a shell script that can be used to start your server - invoke this as your ‘start command’ in render config.
# my app is in main.py and the FastAPI class instance is named 'app'
uvicorn main:app --host 0.0.0.0 --port 10000
Thank you, @splatcollision!! Defining the certain host and port you’ve mentioned, worked!
It should really be mentioned in the documentation. I thought that the default port for gunicorn (8000) would be the one that’s expected from Render, since in the Flask example the deployment command was gunicorn without any arguments.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.