#my backend server not responding according to my application code

53 messages · Page 1 of 1 (latest)

fallen pythonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

surreal orbitBOT
#

Project ID: 0583447a-3b94-4339-9c62-8724bebb6f98

potent notch
#

0583447a-3b94-4339-9c62-8724bebb6f98

potent notch
#

my backend server not responding according to my application code

#

My routes are not working

#

when I'm trying to access them

#

my app is build using dockerfile

potent notch
#

my dockerfile

FROM python:3.9-slim

WORKDIR /app

COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN set -x && apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends ffmpeg

COPY . .

CMD ["gunicorn", "--bind", "0.0.0.0:$PORT", "--timeout", "0", "--workers", "4", "app:app"]
#

Error: '$PORT' is not a valid port number.

#

I have added the variable myself in the railway

silver jay
#

gunicorn listens to 0.0.0.0 and PORT by default, you can remove that as it is redundant

#

you can also remove PORT from your service variables as railway generates a PORT for you behind the scenes on every deployment

potent notch
#

ok let me try that

silver jay
#

let's say it didn't listen on PORT by default and you did need to specify that environment variable in the CMD, you would need to change the syntax and remove the array and write the CMD like this
CMD gunicorn --bind 0.0.0.0:$PORT
reason being is the $PORT is not getting escaped when using the array syntax

potent notch
#

ok

silver jay
#

don't try it, like I said doing it is redundant

#

show me your dockerfile please

potent notch
#

ohk

#

WORKDIR /app

COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN set -x && apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends ffmpeg

COPY . .

CMD ["gunicorn", "--bind", "0.0.0.0", "--timeout", "0", "--workers", "4", "app:app"]```
silver jay
#

like I said, gunicorn listens on 0.0.0.0 by default, specifying that is redundant

#

but being redundant doesn't mean it should stop working, so let's see your deployment logs please

potent notch
#

ohk

silver jay
#

it does work, please follow the instructions

potent notch
silver jay
#

looks good, deployment logs now please

potent notch
silver jay
#

send your requirements.txt please

potent notch
#

btw I don't think there is any problem in all of these but I'll send u wait

#
Flask==2.3.3
librosa==0.10.1
numpy==1.24.0
pydub==0.25.1
streamlink==6.1.0
tensorflow==2.13.0
gunicorn==21.2.0
Flask-CORS==4.0.0
supabase
silver jay
#

aren't you missing tensorrt?

potent notch
#

what is that for?

#

sorry Idk whats that

#

ohk but how using that will help in this case?

silver jay
#

your logs complain about not finding tensor rt, that package supposedly tensor rt

#

have you read the deployment logs yourself?

potent notch
#

thats just a warning that has never affect deploying before

silver jay
#

okay I'm just trying to help

potent notch
#

I think I'm missing something here

#

my first time using railway

silver jay
#

please send your actual Railway domain

potent notch
silver jay
#

well your code does respond

#

so this is just a code issue

potent notch
#

wait

potent notch
#

specifying 0.0.0.0 was casuing the issue

silver jay
#

cool!

potent notch
#

Thanks 🙏