Re: [Django Channels] Disable default django HTTP routes

66 views
Skip to first unread message

ecastro...@gmail.com

unread,
Feb 26, 2019, 6:56:41 PM2/26/19
to Django users
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
Reply all
Reply to author
Forward
0 new messages