Run a uvicorn python app on Railway

eriktoorHOBBY

6 months ago

In the past I have run multiple express apps with

const PORT = parseInt(process.env.PORT || '') || 8000

app.listen(PORT, '0.0.0.0', () => {
console.log('NODEENV: ', process.env.NODEENV)
console.log('listen port ' + PORT)
})

I tried to do the sae thing in uvicorn and run my app like this
PORT = int(os.getenv("PORT", "3000"))
if name == "main":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=PORT)

but my app is not working. Any idea what I am doing wrong? This is my app https://railway.app/project/54f3e95e-8713-41a2-991f-af3046b64747/service/5b305d04-6b17-4767-bab6-1fe015d8b8dd

0 Replies

6 months ago

can you define not working?


eriktoorHOBBY

6 months ago

I guess I expect when I go to my domain

https://withatlaslabs.com/
to see an api response


6 months ago

and what do you see instead


eriktoorHOBBY

6 months ago

I guess now I see this

withatlaslabs.com redirected you too many times.

which might be a DNS issue?


6 months ago


eriktoorHOBBY

6 months ago

Got it working thanks so much for your help!!


6 months ago

no problem!