R
Railway2y ago
kane

Django channels not working on the production environment

I recently deployed a websocket chat app that I developed with Django channels. It works perfectly fine on my local computer even without Daphne web server, but it does not work on production. I followed the docs and installed Daphne, added the configuration on my ProcFile and it still does not work, all I get is a 404 error on every websocket request when I debug. I noticed that my app is still being served with Gunicorn instead of Daphne. Please what am I not doing correctly? Javascript console error: WebSocket connection to 'wss://sitename.up.railway.app/ws/api/chats/create/?token=750e80203245ee5db475006b6229ca391f836f0f12983939330237' failed: Project ID: 4713c1f6-1710-4e59-bfc6-2aaa0aaea3e0 ProcFile Configuration: web: daphne accountGig.asgi:application --port $PORT --bind 0.0.0.0 -v2 Packages : channels==3.0.4 channels-redis==4.1.0 daphne==3.0.2 Django==4.0.3 gunicorn==20.1.0
11 Replies
Percy
Percy2y ago
Project ID: 4713c1f6-1710-4e59-bfc6-2aaa0aaea3e0
Brody
Brody2y ago
do you have a repo please?
kane
kaneOP2y ago
yes i have a private repository
Brody
Brody2y ago
okay screenshot of the repos files please?
kane
kaneOP2y ago
here it is
Brody
Brody2y ago
I see the issue, but first, what is the file named railway for?
kane
kaneOP2y ago
It is autogenerated I didn’t put that there Please where am I wrong ?
Brody
Brody2y ago
ProcFile --> Procfile wrong letter casing
kane
kaneOP2y ago
Oh 🤦🏽‍♂️ I’d change that now and try again : )
Brody
Brody2y ago
small nit pick, you have gunicorn in your requirements but are using daphne, you could remove gunicorn right? the less dependencies the faster the build 🙂
kane
kaneOP2y ago
Thank you very much I renamed procfile and it worked 🫡 definitely I’d be removing gunicorn now, Although daphne is very slow don’t know how to fasten it 🥲
Want results from more Discord servers?
Add your server