Tuesday, January 31, 2017

Re: Django Channels alongside Django Rest Framework

Hi Adam,

The two should be able to coexist without any problem. If you put channels into INSTALLED_APPS then "runserver" is actually running Daphne already anyway, so it's worth noting if that's the case.

You have two options:
 - Run everything via Daphne, which will serve both HTTP and WebSocket requests
 - Run WebSockets via Daphne, and HTTP to a WSGI server, and use something like nginx in front to split the traffic based on path or header.

If you let me know the symptoms of how DRF didn't work via Daphne, I can hopefully help you get things working.

Andrew

On Tue, Jan 31, 2017 at 3:05 AM, <adam.oxley@hedgehoglab.com> wrote:
Hi everyone,

We are currently considering using Django Channels for implementing WebSockets into a project. I am wondering if it is known that Django Channels runs perfectly within the same Django project as DRF? 

I have spent a little time investigating this myself and could manage to get DRF working on its own, but channels not working, and channels working on its own but not DRF (in the same project), depending on whether I ran the daphne server or 'runserver' which I assume runs WSGI. Couldn't find anything online about getting these two side by side.

Thanks,
Adam

======================================================

hedgehog lab is a limited company registered in England and Wales. Registered number: 05993194. Registered office: Generator Studios, Trafalgar Street, Newcastle Upon Tyne, NE1 2LA

--
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/f13e0afc-98a4-4b4c-9315-48f95607e681%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/CAFwN1urBCrZS1m1k%2BGyN0BbniEhoG2Phce9cLDcRk%2BM6daVnFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment