Ah, yes, there is a bug with URLRouter and path() where it will auto-add a
$ to the regex it generates as it doesn't think the right-hand side is an
include. This is likely something I need to patch in Django itself, but
until then I suggest using re_path in any case where you want to match just
a prefix.

Andrew

On Wed, Mar 14, 2018 at 2:13 AM, Kevin Tewouda <lewou...@gmail.com> wrote:

> Thanks Andrew
> i found the mistake myself, my routing file was like this
>
> http_urlpatterns = [
>     path('stream', ServerSentEventsConsumer),
>     path('', AsgiHandler)
> ]
>
>
> I think that the second route will match all the default routes, but like
> it is mentionned in the tutorial, we have to use a *regex *path. So i
> change it to this and it works nice!
>
> http_urlpatterns = [
>     path('stream', ServerSentEventsConsumer),
>     re_path(r'', AsgiHandler)
> ]
>
>
> I think there should be a warning in the tutorial to take particular
> attention with the *path* method introduced in django 2.
>
> Thanks again.
>
> Le mercredi 14 mars 2018 05:19:28 UTC+1, Andrew Godwin a écrit :
>>
>> You can just use channels.http.AsgiHandler as the consumer/ASGI app to
>> hand off to Django views. It's mentioned in the last paragraph here:
>> http://channels.readthedocs.io/en/latest/topics/
>> routing.html#protocoltyperouter
>>
>> Andrew
>>
>> On Tue, Mar 13, 2018 at 9:20 AM, Kevin Tewouda <lewo...@gmail.com> wrote:
>>
>>> Hello,
>>> i am developing an application (a REST one) which have to serve some sse
>>> events to a web application. I saw in the latest documentation how to
>>> create an SSE consumer, but now when i create an http routing for
>>> consumers, i can't serve the others requests using the "classic django view
>>> system". So my question is how can i separate the sse routing from the
>>> other http requests to have all of this working properly.
>>> Thanks in advance for your suggestions.
>>>
>>> Best regards
>>>
>>> --
>>> 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/ms
>>> gid/django-users/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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+unsubscr...@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/7eaa6d7f-d088-4797-af61-dc6f3502136d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7eaa6d7f-d088-4797-af61-dc6f3502136d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> 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+unsubscr...@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/CAFwN1ur2AtqnEWiqPtDHU84qNyrvATZ2kUFzFpQDz5KBPKBurw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to