Tuesday, January 30, 2018

Re: Django-Channels: Debugging

Thanks Andrew, using
print("message", flush=True)

did the trick to get the print messages immediately.

Am Dienstag, 30. Januar 2018 02:00:20 UTC+1 schrieb Andrew Godwin:
I'm not sure why the print messages were buffered - next time try flushing stdout and see if that makes it work.

Andrew

On Mon, Jan 29, 2018 at 6:49 AM, 'Matthias Brück' via Django users <django...@googlegroups.com> wrote:
Ok, i found the problem, the authentification is not working because of django-tenant-schemas. But I'm still wondering why the print messages only gets output after a restart of the worker.

Am Montag, 29. Januar 2018 12:30:54 UTC+1 schrieb Matthias Brück:
Hi everyone,

I have added a websocket connection via django-channels to one of my projects. Everything is working fine locally. But when I try to setup everything on my staging server I never come to the point where actually messages got send and received between the clients and the server. 

I'm running daphne and an asgi-worker with supervisor, making an http upgrade on a specific path in the nginx configuration and let everything else running as it was before with an uwsgi. 

What makes me wonder is that I added some print statements in the websocket consumer to the connect and receive methods but can't find them around the other debug entryies. If I look into the worker log I find messages for every connect of a client:

2018-01-29 11:06:48,905 - DEBUG - worker - Dispatching message on websocket.connect to etf.core.consumers.ws_connect
2018-01-29 11:07:07,727 - DEBUG - worker - Got message on websocket.connect (reply daphne.response.wpTgJPdTsL!DjGrLFgNmv)
2018-01-29 11:07:07,727 - DEBUG - runworker - websocket.connect
2018-01-29 11:07:07,728 - DEBUG - worker - Dispatching message on websocket.connect to etf.core.consumers.ws_connect

If I then restart the worker and daphne I will see the print statemens from the connect, receive methods at the beginning of the file and then again followed with the DEBUG entries but nothing from the print. 

Do you guys have any tip or hint what I could do to better debug websocket/django channels problems? 

Thanks,
Matthias

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d43bfec1-8897-40e8-9cd2-fd070f8d2de5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b178eda0-b471-4835-8a7b-03dec849a0ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment