Django Deployment Issue - 503 Error on Railway Platform
Hello,
I am encountering a 503 error ("Application failed to respond") while deploying my Django application on Railway.
Build and deploy logs contain no errors.
Here are the relevant details:
Deployment Logs:
Build Logs (Partial):
Deployment Setup:
Docker configuration: https://github.com/NikGor/mysite/blob/main/Dockerfile and https://github.com/NikGor/mysite/blob/main/docker-compose.yml
Deployment files: https://github.com/NikGor/mysite/blob/main/railway.yml
Project settings: https://github.com/NikGor/mysite/blob/main/mysite/settings.py
Observations:
The application deploys successfully locally without any errors.
Connection to the DATABASE_URL from Railway works from the local environment.
All required environment variables such as DATABASE_URL, SECRET_KEY, DEBUG, ALLOWED_HOSTS for the Django application are properly configured on the Railway platform.
I am seeking assistance from Django specialists to identify potential issues causing the application to not respond on Railway. I'm confused, because the project was successfully deployed on render.com.
Note:
I acknowledge that I am using the development server in the Dockerfile, which is suitable for small projects. For reference, I based my docker-compose.yml and Dockerfile on the official Django documentation's recommended sample project: https://github.com/dockersamples/link-shortener-django/
Thank you for your expertise and support.
Best regards,
Niko
GitHub
mysite/Dockerfile at main Β· NikGor/mysite
Contribute to NikGor/mysite development by creating an account on GitHub.
GitHub
mysite/docker-compose.yml at main Β· NikGor/mysite
Contribute to NikGor/mysite development by creating an account on GitHub.
GitHub
mysite/railway.yml at main Β· NikGor/mysite
Contribute to NikGor/mysite development by creating an account on GitHub.
GitHub
mysite/mysite/settings.py at main Β· NikGor/mysite
Contribute to NikGor/mysite development by creating an account on GitHub.
GitHub
GitHub - dockersamples/link-shortener-django
Contribute to dockersamples/link-shortener-django development by creating an account on GitHub.
6 Replies
Project ID:
f8ca9e15-d9cc-44c3-93e8-16706de88b07
f8ca9e15-d9cc-44c3-93e8-16706de88b07
Hi Niko. It looks like you're listening on port 8000 when you should be listening on the railway provided
port
variable instead. Give this a read: https://docs.railway.app/troubleshoot/fixing-common-errors and you should be able to fix it. πHi! Thank you for your response. I have another project that I deployed on Railway. In that project, the port 8000 is also explicitly specified, and the application works successfully. Here are its logs:
It's working.
I think the issue is somewhere in Django, but this is one of my first projects, so I'm not sure which aspects I might have overlooked
Oh, maybe it's something above my understanding then, sorry. π I just know this is a common issue. Someone else will surely be along shortly with some better help.
nope, Jon was right