3 ms·
Would anyone who is familiar with both Django and the .js ecosystem care to comment on how they compare? I'm curious to know what how I would find life in the s
by andybak 13y ago
Would anyone who is familiar with both Django and the .js ecosystem care to comment on how they compare? I'm curious to know what how I would find life in the server-side js world. I've not heard of anything in the js ecosystem that's taking on the sort of problems Django tries to solve. (not to say they aren't solving different problems in some better ways)
Is it more sensible to regard Django (and Rails and other frameworks from that generation) and the node ecosystem as complementary rather than competitive at this present time? i.e. to use Django for the content-heavy parts and run node alongside it for the more app-like or real-time aspects?
And is this likely to change over time?
(please - don't let this prompt another micro vs macro framework debate or a discussion on Django being 'too big' - save that for another time)
- meric 13y agoI'm finding the authentication and permissions of Django makes Django Rest Framework trump every server side js library attempting to fill the same role, so far.
- insin 13y agoI think it depends entirely what you need to do and what your programming tastes are. Primarily, will Node's async nature bother you, or is one of the means of dealing via practices or libraries enough for you? I've not found anything in the Node.js world that's as nice as Django's models to sit down with and model the data and relationships required for whatever you need to do and play with it in a REPL as you do so, or kick off an admin config to get the data working before you touch a line of request-handling code. It's a similar story for things that are built on top of django.models, like its auto-admin, or much of the ecosystem of django-* libraries. I couldn't leave django.forms behind, though, so I ported it to JS :) In terms of your everyday handling HTTP requests, it's much of a muchness. Request objects, response objects, get some data, render a template, you know the drill. It's never going to feel the same as Python & Django, but you can comfortably write the sort of apps you write with Django in it, as long as you're down with the asyncness. If anything, certain parts can be even stronger - Jade templates, IMO, make it even more convenient to to do Django-style template inheritance, while its mixins make it much easier to extract reusable chunks of markup + logic without having to step outside templates. You also have the option to reuse templates - and other pieces which support the whole "isomorphic" thing - on the client side , but that not might be the sort of thing you need to do. As ever, "it depends".
- erikcw 13y agoIs your django forms js port open source? If so would you mind posting the URL?
- techdragon 13y agoif its the project I found that does that, then you will find it on github.
- insin 13y agohttps://github.com/insin/newforms https://github.com/insin/newforms The default branch is currently focused on using it with React to add client-side interaction and using React's server rendering - master (0.4.2) can be used for rendering and validation anywhere, though.
- Daishiman 13y agoThe simple fact that Django is an extremely mature framework with very experienced developers with a highly opinionated vision means that you'll definitely avoid a lot of work just because they've been addressing issues many years before Node even existed. That said, it also comes with the baggage of the Python ecosystem. You're not going to find any support for async stuff like node (you'll depend on message queues for async stuff, but frankly there are really nice options out there), and you're not going to find anywhere near the amount of experimental projects. Django is used to solve the use cases of web developers that need to deliver. I would stay away from it if you definitely need high performance or concurrency, but I have not seen many things comparable when it comes to well-engineered, pretty, and functional CRUD apps. Do not underestimate the difficulty of building those.
- temuze 13y agoYeah, there's no accepted way to do Websockets in Python. I'd say Autobahn is probably the closest we have to something like that. That said, it isn't too difficult to hack something together. Kenneth Reitz did a nice little project for Flash websockets that I like: http://kennethreitz.org/introducing-flask-sockets/ http://kennethreitz.org/introducing-flask-sockets/ Python 3.4 has that nice ayncio module built in. I'm hoping it'll be a big draw for people into Python 3.
- jkarneges 13y agoPeople do write entire conventional web apps (e.g. REST APIs) with Node, so I'd say they are competitive and that it comes down to taste. If you're being drawn to Node because of real-time stuff, though, I personally would suggest a mixed architecture. I'm a fan of using Django for the conventional stuff and then something else alongside it for real-time. You can use a reverse proxy in front to make the services appear to be unified.