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:Jump to solution
maybe you have set the start command in the service settings? that would override the command in the procfile
26 Replies
Project ID:
c632aa00-e02e-45a6-bec7-0aa741699039
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
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?
show me the full deploy logs please
Here are the deploy logs
can you show me the table at the top of your build logs please
i dont see a
--no-input
flag?I pushed it to github, I can see it in the Procfile there.
Solution
maybe you have set the start command in the service settings? that would override the command in the procfile
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.
check
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.
maybe you have set the start command in the service settings? that would override the command in the procfile
Oh, sorry. How do I check that?
In the service settings
hmm, it is there. Weird.
remove it
do you happen to have a railway.json file in your repo?
nope, no railway.json.
okay then you must have set it and forgot about it
Ok, maybe, I had no idea what I was doing. I removed the service settings command and it's redeploying now.
sounds good
let me know how that goes
Should I have railway.json?
ideally, but it's not like railway will ever drop support for Procfiles so you're fine
π
the deployment worked! Thank you so much for your help!
awesome, no problem! π