GithubHelp home page GithubHelp logo

Comments (7)

andrewgodwin avatar andrewgodwin commented on July 24, 2024 1

(Generally, you don't want to route http.request in the routing and just leave it out so it does the default, which is exactly what you want. You only need to route it yourself if you're doing something unusually low-level)

from channels.

andrewgodwin avatar andrewgodwin commented on July 24, 2024 1

Good point, I thought I had. Added a paragraph in there.

from channels.

carltongibson avatar carltongibson commented on July 24, 2024 1

@itsmehdi97 Take a look at the example here: https://channels.readthedocs.io/en/stable/topics/routing.html#urlrouter
It covers the exact use-case you're asking about.

from channels.

andrewgodwin avatar andrewgodwin commented on July 24, 2024

Yes, you can use the channels.handler.ViewConsumer to pass any http.request message into the view system, though this is done for you by default.

In addition, in the latest master code, the routing gains the ability to route to custom HTTP endpoints/WebSocket consumers based on url (path), and will always fall back to Django's view handling if nothing processes a http.request message.

from channels.

mandx avatar mandx commented on July 24, 2024

Got it, thanks! I just didn't find the docs section stating that this already happens by default. Thanks for the quick reply!

from channels.

ThaJay avatar ThaJay commented on July 24, 2024

Channels is looking really good this far. Perhaps explicitly add this to the starting section of the docs? I did not find it either so had to come here to find this out.

from channels.

itsmehdi97 avatar itsmehdi97 commented on July 24, 2024

Is it possible to process some of http requests by channels consumers and some of them by the traditional django views based on their url?
Actually I need to add a single endpoint that should be asynchronous - using consumers - and others are simple rest-framework views.
I thought this issue is related to my question but I couldn't find the channels.handler.ViewConsumer you mentioned here .

from channels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.