5 ms·
> Does Django have a bright future in a world that's moving heavily client side Where are you getting the data for the client from? Django-Rest-Framework is a
by adamauckland 13y ago
> Does Django have a bright future in a world that's moving heavily client side
Where are you getting the data for the client from? Django-Rest-Framework is a very convenient way to get data down into the browser layer from a DB.
- euroclydon 13y agoI think this is an area where ASP.NET MVC excels because, while REST is nice, you also have to consider web sockets, and I have not seen good web socket support in Django, where ASP.NET has SignalR which is loads easier to configure than a custom solution with Django and Nginx/Apache. Not to mention that SignalR has very nice degradation support on both ends when web sockets are not available.
- rattray 13y agoThere is a socket.io server for Python that claims to work with Django: https://github.com/abourget/gevent-socketio https://github.com/abourget/gevent-socketio I haven't used it personally, and would be very interested to hear others' thoughts. EDIT: Looking through the example code ( https://github.com/abourget/gevent-socketio/tree/master/examples/django_chat https://github.com/abourget/gevent-socketio/tree/master/exam... ), it doesn't seem as straightforward as one might hope, especially compared to the channels API. FWIW, I'm using the AppEngine Channels API from my Django app, and have yet to be disappointed with it.
- bad_user 13y agoWell, if you're talking about alternatives that do asynchronism, Comet and Web Sockets well, the most convenient framework I ever used is Play 2.1 The framework is said to be reactive, meaning that you can build components that react to events asynchronously. The architecture is completely awesome, as Akka actors are baked in and the protocols are modelled with Futures and Iteratees, an FP concept for sane I/O. Things like serving unending streams of data and responding to client events using async I/O are in the very foundations of the framework, instead of being taked on later. People using Node.js or Tornado or whatever, don't know what they are missing. See their docs on the subject: - for Scala: http://www.playframework.com/documentation/2.1.1/ScalaAsync http://www.playframework.com/documentation/2.1.1/ScalaAsync - for Java: http://www.playframework.com/documentation/2.1.1/JavaAsync http://www.playframework.com/documentation/2.1.1/JavaAsync
- euroclydon 13y agoI've heard it's revolutionary! How do you host Play in production?
- bad_user 13y agoWe are using Amazon's EC2 for a huge-traffic web service (because ELB with auto-scalling has been working great for us) and Heroku for auxiliary services. Deployment to Heroku works out of the box btw.
- euroclydon 13y agoI mean, which web server? What is the built-in start/stage server built on? Can you place it behind Nginx?
- playing_colours 13y agoThe built-in server is Netty, a non-blocking one, and you can deploy your Play webapp as a stand-alone server, or use Nginx, Apache etc. http://www.playframework.com/documentation/2.1.1/HTTPServer http://www.playframework.com/documentation/2.1.1/HTTPServer
- jeffasinger 13y agoThe root of this problem is that WSGI doesn't play nicely with asynchronous stuff. Socket.io for node.js is very awesome for stuff like that.
- adamauckland 13y agoHave you any experience with uWSGI? Socket.io is good, but it falls back to polling AJAX.
- marcosdumay 13y agoFor websockets, I set the Django framework inside a Tornado thread. By doing that I lose the wsgi functionality (you get only low level stuff, just like you'll get on java or .net), must synchronize with the normal http server with the DB (what I'll do anyway, since it's the easiest path with Django), and there is some dificulty dealing with signals (the same you'll get with java or .net). And that's all. Or, TLDR, you lose a few features, that'll make your code resemble a bit more what you'd need to write in java or .net, but preserves most of it.
- euroclydon 13y agoInteresting. If you have any further guidance on that I'd love to bookmark it.