R
Railwayβ€’17mo ago
arinai

Django deployment error

Hi! I am following along this Mozilla tutorial for deploying Django to Railway (https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment#update_the_app_for_railway), and my app deployment keeps crashing. The logs suggest that it's crashing because the collectstatic command I have in my Procfile (which I simply copied from the tutorial) is asking for user input and crashes after waiting for it. I tried adding a no-input option for collectstatic and it didn't help. My Procfile contains this: web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn collie.wsgi After some googling, it seems to me that Procfiles are supposed to only contain the command to run the app, and aren't really meant to handle things like migrations and file organization, so the migrate and collectstatic commands shouldn't be in my Procfile. Is that correct? If so, then where should I have the migrate and collectstatic commands? My project id: c632aa00-e02e-45a6-bec7-0aa741699039
Django Tutorial Part 11: Deploying Django to production - Learn web...
That's the end of this tutorial on setting up Django apps in production, and also the series of tutorials on working with Django. We hope you've found them useful. You can check out a fully worked-through version of the source code on GitHub here.
Solution:
maybe you have set the start command in the service settings? that would override the command in the procfile
Jump to solution
26 Replies
Percy
Percyβ€’17mo ago
Project ID: c632aa00-e02e-45a6-bec7-0aa741699039
Brody
Brodyβ€’17mo ago
ideally youd run them in the build stage, but railway provides very little documentation on how you would go about doing that, and even the official django template for railway runs migrate and collectstatic in the start command for simplicity
arinai
arinaiOPβ€’17mo ago
If it's ok to have those commands in Procfile, then why is my project failing and how can I fix it? The logs say that the collectstatic command is waiting for user input before the project crashes. How do I fix this?
Brody
Brodyβ€’17mo ago
show me the full deploy logs please
arinai
arinaiOPβ€’17mo ago
Here are the deploy logs
Brody
Brodyβ€’17mo ago
can you show me the table at the top of your build logs please
arinai
arinaiOPβ€’17mo ago
Brody
Brodyβ€’17mo ago
i dont see a --no-input flag?
arinai
arinaiOPβ€’17mo ago
I pushed it to github, I can see it in the Procfile there.
Solution
Brody
Brodyβ€’17mo ago
maybe you have set the start command in the service settings? that would override the command in the procfile
arinai
arinaiOPβ€’17mo ago
I don't think so, unless I did it by accident somehow. I was following that Mozilla tutorial and it just said to put that start command in the Procfile and push it to github.
Brody
Brodyβ€’17mo ago
check
arinai
arinaiOPβ€’17mo ago
I've noticed that I have this "All checks have failed" message on the commit in github that added the --no-input flag, in case it's helpful.
Brody
Brodyβ€’17mo ago
maybe you have set the start command in the service settings? that would override the command in the procfile
arinai
arinaiOPβ€’17mo ago
Oh, sorry. How do I check that?
Brody
Brodyβ€’17mo ago
In the service settings
arinai
arinaiOPβ€’17mo ago
hmm, it is there. Weird.
Brody
Brodyβ€’17mo ago
remove it do you happen to have a railway.json file in your repo?
arinai
arinaiOPβ€’17mo ago
nope, no railway.json.
Brody
Brodyβ€’17mo ago
okay then you must have set it and forgot about it
arinai
arinaiOPβ€’17mo ago
Ok, maybe, I had no idea what I was doing. I removed the service settings command and it's redeploying now.
Brody
Brodyβ€’17mo ago
sounds good let me know how that goes
arinai
arinaiOPβ€’17mo ago
Should I have railway.json?
Brody
Brodyβ€’17mo ago
ideally, but it's not like railway will ever drop support for Procfiles so you're fine
arinai
arinaiOPβ€’17mo ago
πŸ‘ the deployment worked! Thank you so much for your help!
Brody
Brodyβ€’17mo ago
awesome, no problem! πŸ™‚
Want results from more Discord servers?
Add your server