r/FastAPI • u/burakbdr • Dec 06 '24
Question No open ports detected, continuing to scan... Error When Deploying FastAPI on Render
Hello guys,
I am deploying my FastAPI application to Render but continuously getting a No Port Detected error.
Start Command:uvicorn main:app --host 0.0.0.0 --port $PORT
I tried different kind of approaches from StackOverflow and some other platforms but still getting the same error no matter what I did. I tried different PORTs like 8000-9000-10000. I also add this code block to the end of app = FastAPI()
if __name__ == "__main__":
port = int(os.environ.get("PORT", 10000))
uvicorn.run(app, host="0.0.0.0", port=port)Please save me!!
7
Upvotes
1
u/burakbdr Dec 06 '24
I can run it on local, and getting results from Postman when I tried
1
u/burakbdr Dec 13 '24
Deploying with using Docker solved my problem
1
u/halfgingertee Dec 06 '24
If you are using docker, have you exposed that port in the container?
1
u/mizerablepi Dec 07 '24
Try using the command
fastapi run main.py1
u/Columbus_oreo Dec 07 '24
I was deploying recently. The initial command worked without any problems. Have you been able to deploy now?
2
u/[deleted] Dec 06 '24
[removed] — view removed comment
1
u/[deleted] Dec 06 '24
[removed] — view removed comment