5 months ago
I'm not sure why I keep getting the 404 Error on all endpoints. Can anyone see anything that I am missing
Logfile:
Starting Container
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
PROCFILE:
web: uvicorn main:app --host 0.0.0.0 --port $PORT
DOCKERFILE:
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . . CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
2 Replies
5 months ago
Are you sure the routes exist? (And/or are you sure you've correctly typed the routes you're trying to access?)
5 months ago
your dockerfile hardcodes port 8000 but railway needs you to use their $PORT variable. change your dockerfile cmd line to:
CMD uvicorn main:app --host 0.0.0.0 --port ${PORT:-8000}or just delete the procfile since you have a dockerfile. right now railway is routing to a different port than where your app is actually listening, thats why everything 404s even tho the app starts fine