Deploying Django with celery
Hi everyone. I have a simple django api service, which makes use of celery. for handling the background tasks. Usually in local, I start django in one shell and celery in another shell and its works just fine. But I am not sure how to do that in railway. My current proc file looks like this .
Thanks. Any help is much appreciated?
36 Replies
Project ID:
N/A
N/A
1. you aren't using gunicorn, you should definitely be using gunicorn
2. railway's Procfile support is not 1:1 functionally equivalent to heroku's Procfile support, thus railway does not support defining two processes to be run in parallel, you will want to use a single command with a single &
the order I think would work best would be to start the celery worker first.
when on railway, you don't need to use the railway cli anymore
I am using daphne for my websockets. Is it okay if i just use daphne instead of gunicorn?
It will look something like this
yeah looks good to me, give it a try?
its building.
Just got hit with this error.
the errors itself tells you how to fix that
Yeah, it does. I should add the code snippet, in my django project itself.
Sorry, about my previous message. I don't think there is a way to do that in the proc file
imo create a python file that does the download and run it before you start daphne
okay. but how do run that file in the ProcFile?
Something like this?
yes, see you know stuff!
it worked! But got this error. even though i tried to update the file which download punkt to also download the chrome driver.
here is the file
what are you using chrome for?
the django app uses chrome to do some scraping.
does the site you are scrapping allow scrapping?
yes, it does.
🤨
or I think so. I am scraping one of the pages of langchain docs
sounds harmless enough
yeah. i didn't think it would be a problem, since it was open source
you are installing the chrome driver, but dont you also need to install chrome too
okay.. I think then the proc file should look like this?
does proc file support apt-get install?
it would work, but do not do it like that
hold
remove the apt-get command from your procfile and use this as a nixpacks.toml file
does railway automcatically picks up the nixpacks.toml file form the repository? or do i need to mention it in the proc file?
thanks!
automatically
Still the same error
This is what i got when i searched the build logs for
This is what my app details looks like
looks like you might want to move to a Dockerfile based build
could you point me to sources that i can refer to for a Dockerfile based build. I am not really familiar with docker.
Google lol
it seems like a cop out answer, but since I haven't done a python and chrome dockerfile myself, I'd be using Google
yeah. i thought maybe railway, provides the template for a dockerfile. or something
you wouldn't believe me when i tell this but, you helped me a lot today. thanks man.
unfortunately not, such specific use cases are up to the users
thank you 🙂
once i have the docker file, do i need to delete the proc file, runtime.txt and nixpacks.toml?
correct
none of that stuff is applicable to a Dockerfile build
Hi. I buit the dockerfile, but I am having issues with versioning for Chromedriver and Chromium. They need to be the same.
Here is the code, which gets the version of the chromium and then downloads the chrome driver for that specific version
I was wondering if you have seen anything like this.
I got it working!
Chromium was a real pain in the ass. I am using google instead. Even though chromium is lightweight. I think I will stick to google chrome for a while. Here is the dockerfile
Thanks for all the help
hey thats awasome, great work!!