R
Railwayβ€’16mo ago
nikostolz

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:
Watching for file changes with StatReloader
Performing system checks...
Django version 4.1.7, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Watching for file changes with StatReloader
Performing system checks...
Django version 4.1.7, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Build Logs (Partial):
Pushing [==============================> ] 8.558MB/14.14MB 9ad7500d568a
...
Pushed 9ad7500d568a
Pushing [==================================================>] 56.56MB 6738ac10cb3e
Pushing [==================================================>] 58.7MB 6738ac10cb3e
...
Pushing [==============================> ] 8.558MB/14.14MB 9ad7500d568a
...
Pushed 9ad7500d568a
Pushing [==================================================>] 56.56MB 6738ac10cb3e
Pushing [==================================================>] 58.7MB 6738ac10cb3e
...
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
Percy
Percyβ€’16mo ago
Project ID: f8ca9e15-d9cc-44c3-93e8-16706de88b07
nikostolz
nikostolzOPβ€’16mo ago
f8ca9e15-d9cc-44c3-93e8-16706de88b07
jonbeau
jonbeauβ€’16mo ago
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. πŸ‘
Railway Docs
Fixing Common Errors | Railway Docs
Documentation for Railway
nikostolz
nikostolzOPβ€’16mo ago
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:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 24, 2023 - 12:06:53
Django version 4.1.7, using settings 'task_manager.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 24, 2023 - 12:06:53
Django version 4.1.7, using settings 'task_manager.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
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
jonbeau
jonbeauβ€’16mo ago
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.
Brody
Brodyβ€’16mo ago
nope, Jon was right
Want results from more Discord servers?
Add your server