Tuesday, February 26, 2019

Re: [Django Channels] Disable default django HTTP routes

I solved it by adding a catch all route with an AsyncHttpConsumer that returns 404

El martes, 26 de febrero de 2019, 20:16:56 (UTC-3), ecastro...@gmail.com escribió:
[Django Channels] Disable default django HTTP routes
Is there a way to disable django HTTP routes? I've two servers threaded and async, and I want to disable the django routes in the async server. I read the docs, didn't find an answer.

Doing:

application = ProtocolTypeRouter({
    'http': URLRouter([]),
    'websocket': URLRouter(
        apps.rt.routing.websocket_
urlpatterns
    )
})

Gives me

[2019-02-26 19:13:22 +0000] [7] [ERROR] Exception in ASGI application

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 371, in run_asgi

    asgi = app(self.scope)

  File "/usr/local/lib/python3.7/site-packages/channels/routing.py", line 58, in __call__

    return self.application_mapping[scope["type"]](scope)

  File "/usr/local/lib/python3.7/site-packages/channels/routing.py", line 154, in __call__

    raise ValueError("No route found for path %r." % path)

-------

and an internal error

--
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/ee0f64d0-fa74-479f-95f8-43e77a3c8b0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment