Re: Integrating Django with Tornado's web server
Hi, I used django-websocket-redis for implementing webscet in django project. You could try that. Regards Asif On Monday, September 14, 2009 at 3:30:59 AM UTC+7, Bret Taylor wrote: > > I am one of the authors of Tornado (http://www.tornadoweb.org/), the > web server/framework we built at FriendFeed that we open sourced last > week (see http://bret.appspot.com/entry/tornado-web-server). > > I just checked in change to Tornado that enables you to run any WSGI- > compatible framework on Tornado's HTTP server so that Django apps > could run on top of Tornado's HTTP server and benefit from some of the > performance work we have done. (I just sent a message to django-users@ > with getting started instructions as well, but if you are interested, > take a look at > http://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). > > I chose the WSGI approach because it is generic and applies to all > frameworks, but Django is obviously the most widely used. I am curious > if there is any benefit to implementing more "native" support in > django.core.handlers or if WSGI is the preferred way of adding support > for new servers. If there is any performance or usability benefit, let > me know, because we would be happy to contribute our time to make it > happen. > > In the meantime, if you find any issues with our WSGI support, let me > know so we can fix problems. > > Bret > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/84486ed5-ee46-42d1-8925-e1d9ff7984e6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Integrating Django with Tornado's web server
Hi Bastin, I know you addressed the question to bret, but i would like to suggest what i did , i actually used gevent-socketio with the pywsgi server . I did it a while ago so dont know if things are the same. If you find something better then do tell. On Wednesday, October 21, 2015 at 4:52:23 PM UTC+5:30, Bastin Robins J wrote: > > Hi Bret, > > We have built our app using django 1.7 and we need to implement websockets > for some async purpose. So thought tornado would suit our need > Can you tell me a best practice to achieve this. > > On Monday, September 14, 2009 at 2:00:59 AM UTC+5:30, Bret Taylor wrote: >> >> I am one of the authors of Tornado (http://www.tornadoweb.org/), the >> web server/framework we built at FriendFeed that we open sourced last >> week (see http://bret.appspot.com/entry/tornado-web-server). >> >> I just checked in change to Tornado that enables you to run any WSGI- >> compatible framework on Tornado's HTTP server so that Django apps >> could run on top of Tornado's HTTP server and benefit from some of the >> performance work we have done. (I just sent a message to django-users@ >> with getting started instructions as well, but if you are interested, >> take a look at >> http://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). >> >> I chose the WSGI approach because it is generic and applies to all >> frameworks, but Django is obviously the most widely used. I am curious >> if there is any benefit to implementing more "native" support in >> django.core.handlers or if WSGI is the preferred way of adding support >> for new servers. If there is any performance or usability benefit, let >> me know, because we would be happy to contribute our time to make it >> happen. >> >> In the meantime, if you find any issues with our WSGI support, let me >> know so we can fix problems. >> >> Bret >> > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/04f525f0-e376-496c-b8d1-d304b1a2a0dc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Integrating Django with Tornado's web server
Hi Bret, We have built our app using django 1.7 and we need to implement websockets for some async purpose. So thought tornado would suit our need Can you tell me a best practice to achieve this. On Monday, September 14, 2009 at 2:00:59 AM UTC+5:30, Bret Taylor wrote: > > I am one of the authors of Tornado (http://www.tornadoweb.org/), the > web server/framework we built at FriendFeed that we open sourced last > week (see http://bret.appspot.com/entry/tornado-web-server). > > I just checked in change to Tornado that enables you to run any WSGI- > compatible framework on Tornado's HTTP server so that Django apps > could run on top of Tornado's HTTP server and benefit from some of the > performance work we have done. (I just sent a message to django-users@ > with getting started instructions as well, but if you are interested, > take a look at > http://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). > > I chose the WSGI approach because it is generic and applies to all > frameworks, but Django is obviously the most widely used. I am curious > if there is any benefit to implementing more "native" support in > django.core.handlers or if WSGI is the preferred way of adding support > for new servers. If there is any performance or usability benefit, let > me know, because we would be happy to contribute our time to make it > happen. > > In the meantime, if you find any issues with our WSGI support, let me > know so we can fix problems. > > Bret > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b05f8edd-891f-4024-9351-01e02c8cbd28%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Integrating Django with Tornado's web server
On Sep 15, 3:25 am, Mike Malonewrote: > > I just checked in change to Tornado that enables you to run any WSGI- > > compatible framework on Tornado's HTTP server so that Django apps > > could run on top of Tornado's HTTP server and benefit from some of the > > performance work we have done. (I just sent a message to django-users@ > > with getting started instructions as well, but if you are interested, > > take a look > > athttp://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). > > Great news, there was a lot of discussion at DjangoCon last week after > the Tornado launch about this possibility. There was a bit of hacking > on it during the Django sprints, but things seemed to stall as people > realized there were a few incompatibilities due to Tornado munging > some of the HTTP headers (not sure the details, as I wasn't working on > this stuff personally). Awesome to hear you made it work! > > > I chose the WSGI approach because it is generic and applies to all > > frameworks, but Django is obviously the most widely used. I am curious > > if there is any benefit to implementing more "native" support in > > django.core.handlers or if WSGI is the preferred way of adding support > > for new servers. If there is any performance or usability benefit, let > > me know, because we would be happy to contribute our time to make it > > happen. > > It would be interesting if you could formalize your issues with WSGI > (it's not a horrible solution, but there are certainly places where it > could be improved). Armin Ronacher was talking about updating the WSGI > PEP at DjangoCon and was soliciting ideas, so you may want to get in > touch with him and offer some suggestions for making WSGI work with > high performance containers like Tornado. Please, no async support in WSGI. It is not a good match. Even running WSGI in a thread pool on top of async is a bad idea for a multiprocess web server because you can't prevent the process accepting more requests than the WSGI application can handle via the thread pool at any one time. End result is that you can unnecessarily block requests in one process which could otherwise have been handled by another process which has available resources to handle them. WSGI on top of non async multiprocess servers like Apache don't have this issue as Apache will only accept connections when it knows that it has available threads to handle the request. Part of the reason that any update to WSGI specification has not come out, is because the async crowd has derailed the discussion a couple of times. The core people around WSGI do not believe that async support should be a part of it, so please, if you want a standardised async interface, do it independently. Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Integrating Django with Tornado's web server
> I just checked in change to Tornado that enables you to run any WSGI- > compatible framework on Tornado's HTTP server so that Django apps > could run on top of Tornado's HTTP server and benefit from some of the > performance work we have done. (I just sent a message to django-users@ > with getting started instructions as well, but if you are interested, > take a look at > http://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). Great news, there was a lot of discussion at DjangoCon last week after the Tornado launch about this possibility. There was a bit of hacking on it during the Django sprints, but things seemed to stall as people realized there were a few incompatibilities due to Tornado munging some of the HTTP headers (not sure the details, as I wasn't working on this stuff personally). Awesome to hear you made it work! > I chose the WSGI approach because it is generic and applies to all > frameworks, but Django is obviously the most widely used. I am curious > if there is any benefit to implementing more "native" support in > django.core.handlers or if WSGI is the preferred way of adding support > for new servers. If there is any performance or usability benefit, let > me know, because we would be happy to contribute our time to make it > happen. It would be interesting if you could formalize your issues with WSGI (it's not a horrible solution, but there are certainly places where it could be improved). Armin Ronacher was talking about updating the WSGI PEP at DjangoCon and was soliciting ideas, so you may want to get in touch with him and offer some suggestions for making WSGI work with high performance containers like Tornado. Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Integrating Django with Tornado's web server
On Sep 14, 8:05 am, Russell Keith-Mageewrote: > On Mon, Sep 14, 2009 at 4:30 AM, Bret Taylor wrote: > > > I am one of the authors of Tornado (http://www.tornadoweb.org/), the > > web server/framework we built at FriendFeed that we open sourced last > > week (seehttp://bret.appspot.com/entry/tornado-web-server). > > > I just checked in change to Tornado that enables you to run any WSGI- > > compatible framework on Tornado's HTTP server so that Django apps > > could run on top of Tornado's HTTP server and benefit from some of the > > performance work we have done. (I just sent a message to django-users@ > > with getting started instructions as well, but if you are interested, > > take a look > > athttp://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). > > This is awesome news, Bret! I've only taken a brief look at Tornado so > far, but it certainly looks interesting; having easy support for WSGI > (and therefore Django) makes it even more compelling. > > > I chose the WSGI approach because it is generic and applies to all > > frameworks, but Django is obviously the most widely used. I am curious > > if there is any benefit to implementing more "native" support in > > django.core.handlers or if WSGI is the preferred way of adding support > > for new servers. If there is any performance or usability benefit, let > > me know, because we would be happy to contribute our time to make it > > happen. > > I'd be surprised if there aren't some friction points that could be > optimized by using a Tornado-native interface, especially if you're > looking to exploit some of the specific capabilities of Tornado. > > However, this leads us to an interesting chicken-and-egg situation. No > offense intended to yourself and the great work you have done, but > Tornado isn't a major market leader (not yet, anyway). The Django core > team is very sensitive to the fact that adding something to the Django > Core is effectively seen as "blessing" something as stable and worth > using, and Tornado hasn't been around long enough in the public > sphere to warrant that kind of recommendation. > > At least initially, I'd prefer to see Django-Tornado support as a > project external to the Django core. It's all just Python code, after > all - having a Tornado handler in the Django tree rather than > somewhere else PYTHONPATH doesn't make the underlying functionality > any more or less accessible. The existing mod_python and mod_wsgi > interfaces could easily live outside the Django tree; For the record, there is no mod_wsgi specific interface in Django. It uses the standardised WSGI interface that Django provides and which is the same interface that all WSGI capable hosting mechanisms would use. Graham > they're just > present as part of the 'batteries included' strategy that covers the > most common mechanisms for deploying Python-based web applications at > present. > > If, in the process of building and external Django support library for > Tornado, you find that it is necessary to modify the core in order to > support a particular feature of Tornado, raise a ticket in Django's > Trac instance, start a discussion on this mailing list, and we'll look > at making that change. > > This externalized approach would also be in the interests of the > binding anyway. The rapid release/update schedules required by a new > and emerging project aren't really compatible with an established > framework like Django where the initial rapid development effort has > plateaued and been replaced with a slower process of incremental > updates. Long term, it may be appropriate to integrate Tornado support > into the Django core, but it would be better to wait until the > interface has matured before we look at integration. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Integrating Django with Tornado's web server
On Sep 13, 3:05 pm, Russell Keith-Mageewrote: > > I chose the WSGI approach because it is generic and applies to all > > frameworks, but Django is obviously the most widely used. I am curious > > if there is any benefit to implementing more "native" support in > > django.core.handlers or if WSGI is the preferred way of adding support > > for new servers. If there is any performance or usability benefit, let > > me know, because we would be happy to contribute our time to make it > > happen. > > I'd be surprised if there aren't some friction points that could be > optimized by using a Tornado-native interface, especially if you're > looking to exploit some of the specific capabilities of Tornado. > > However, this leads us to an interesting chicken-and-egg situation. No > offense intended to yourself and the great work you have done, but > Tornado isn't a major market leader (not yet, anyway). The Django core > team is very sensitive to the fact that adding something to the Django > Core is effectively seen as "blessing" something as stable and worth > using, and Tornado hasn't been around long enough in the public > sphere to warrant that kind of recommendation. Of course, sorry for the miscommunication. I meant implementing a Django "native" handler as a module in Tornado, not actually moving the module to Django core. It is a bit unclear to me at this point what the handler interface is - some of the modules in that package subclass http.HttpRequest and some subclass base.BaseHandler, but the assumptions about environment variables seem to be spread between a bit spread between the modules. I will just leave it as wsgi for now unless there is demand. Bret --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Integrating Django with Tornado's web server
On Mon, Sep 14, 2009 at 4:30 AM, Bret Taylorwrote: > > I am one of the authors of Tornado (http://www.tornadoweb.org/), the > web server/framework we built at FriendFeed that we open sourced last > week (see http://bret.appspot.com/entry/tornado-web-server). > > I just checked in change to Tornado that enables you to run any WSGI- > compatible framework on Tornado's HTTP server so that Django apps > could run on top of Tornado's HTTP server and benefit from some of the > performance work we have done. (I just sent a message to django-users@ > with getting started instructions as well, but if you are interested, > take a look at > http://github.com/facebook/tornado/blob/master/tornado/wsgi.py#L188). This is awesome news, Bret! I've only taken a brief look at Tornado so far, but it certainly looks interesting; having easy support for WSGI (and therefore Django) makes it even more compelling. > I chose the WSGI approach because it is generic and applies to all > frameworks, but Django is obviously the most widely used. I am curious > if there is any benefit to implementing more "native" support in > django.core.handlers or if WSGI is the preferred way of adding support > for new servers. If there is any performance or usability benefit, let > me know, because we would be happy to contribute our time to make it > happen. I'd be surprised if there aren't some friction points that could be optimized by using a Tornado-native interface, especially if you're looking to exploit some of the specific capabilities of Tornado. However, this leads us to an interesting chicken-and-egg situation. No offense intended to yourself and the great work you have done, but Tornado isn't a major market leader (not yet, anyway). The Django core team is very sensitive to the fact that adding something to the Django Core is effectively seen as "blessing" something as stable and worth using, and Tornado hasn't been around long enough in the public sphere to warrant that kind of recommendation. At least initially, I'd prefer to see Django-Tornado support as a project external to the Django core. It's all just Python code, after all - having a Tornado handler in the Django tree rather than somewhere else PYTHONPATH doesn't make the underlying functionality any more or less accessible. The existing mod_python and mod_wsgi interfaces could easily live outside the Django tree; they're just present as part of the 'batteries included' strategy that covers the most common mechanisms for deploying Python-based web applications at present. If, in the process of building and external Django support library for Tornado, you find that it is necessary to modify the core in order to support a particular feature of Tornado, raise a ticket in Django's Trac instance, start a discussion on this mailing list, and we'll look at making that change. This externalized approach would also be in the interests of the binding anyway. The rapid release/update schedules required by a new and emerging project aren't really compatible with an established framework like Django where the initial rapid development effort has plateaued and been replaced with a slower process of incremental updates. Long term, it may be appropriate to integrate Tornado support into the Django core, but it would be better to wait until the interface has matured before we look at integration. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---