7 ms·
As a Rails dude...is there any reason for me to learn Django at all? Everything I've heard about it is that it provides a lot of sane defaults (like Rails) but
by dchuk 10y ago
As a Rails dude...is there any reason for me to learn Django at all? Everything I've heard about it is that it provides a lot of sane defaults (like Rails) but has much less "magic" than Rails is typically thought to have.
And if the answer to my question is yes, what books/tutorials/screencasts/courses to people recommend to get started with?
- varikin 10y agoI don't see why you would need to learn it unless you wanted/needed to work on Python web projects. It is a fairly standard, opinionated web framework. I don't think there is anything unique enough to make learning it special.
- ronjouch 10y agoIf you're familiar with Ruby/Rails, I don't see any reason to switch. They're both good large frameworks. As you said, yes Django may sometimes feel a bit less "magic", due to Python's "explicit is better than implicit" motto, https://www.python.org/dev/peps/pep-0020/ https://www.python.org/dev/peps/pep-0020/ If you want to give it a try anyway, Two Scoops of Django is a wonderful book, by two warm contributors from the Python community. https://www.twoscoopspress.com/ https://www.twoscoopspress.com/
- nprescott 10y agoI can't answer your first question, they're similar high-level web frameworks - do you want to learn another? As for books, I'd recommend Two Scoops of Django[1]. Between that and the tutorial you should be up to speed pretty quickly. Maybe read it and see if anything appeals to you about Django? [1]: https://www.twoscoopspress.com/ https://www.twoscoopspress.com/
- Walkman 10y agoMy suggestion: don't bother. The "less magic" things comes because of Python's explicitness (not because of Django at all).
- dguaraglia 10y agoWell, there was actually a concerted effort to remove magic (back in pre 1.0, in a branch aptly called "magic-removal".) The problem was that convention-over-configuration was tripping a lot of new people. It was actually the reason I decided to go with Django over Rails. That said, I feel like nowadays Rails and Django are more or less equally capable, so choosing one over the other might be a matter of language and ecosystem preference over anything else.
- hrayr 10y agoThe typical recommendation to getting started with Django, is to go through the tutorial included in the documentation [0]. This is the path I took several years ago, it'll get you up and running in no time. I found Two Scoops of Django[0] to be a great resource if you want to follow the best practices for a Django app. The authors are also very active in the community. [0] https://docs.djangoproject.com/en/1.10/intro/tutorial01/ https://docs.djangoproject.com/en/1.10/intro/tutorial01/ [1] https://www.twoscoopspress.com/products/two-scoops-of-django-1-8 https://www.twoscoopspress.com/products/two-scoops-of-django...
- mkane848 10y agoSeconded on both points - found the Django docs themselves to be AMAZINGLY helpful (to the point where I feel spoiled) when learning. Found another toy project or two online to learn and play with, then read through Two Scoops to really cement the ideas more and get some ideas on best practices AND went back to it a few times during development for reference.
- heyts 10y agoIf you plan to use Django as an API server, you might be interested in Lightweight Django (http://shop.oreilly.com/product/0636920032502.do http://shop.oreilly.com/product/0636920032502.do), which shows you how to design and build an API server using Django, Django Rest Framework (another great Django related project) and Backbone on the front-end.
- CuriouslyC 10y ago2010 called, it wants its tech stack back ;)
- heyts 10y agoAdmittedly but Backbone is _still_ a good intro to Front-end frameworks because it has a steep learning curve upfront instead of, say, angular that seems easy enough to pick up until you try to tackle non trivial applications.
- __jal 10y agoHalf-implemented, broken and cool is more fun than solid and battle-tested, and that's perfectly fine so long as you don't get yourself fired over a bad choice - have a great time. Honestly, I used to be more novelty-driven, too. But battle-tested and boring has its place. Now get off my lawn.
- wyldfire 10y agoSorry, the off-lawn module depends on left-pad. :(
- CuriouslyC 10y agoThere is no point unless you are going to using a lot of Python's scientific computing apparatus, or you want the ability to rewrite "hot" code in Cython for better performance. If you are primarily focused on social-esque or CRUD-heavy apps there isn't really an upside vs Rails.
- RussianCow 10y agoWhat could you possibly be doing that you need those things within a Django app? If you're placing CPU-intensive and scientific code directly into your web app backend, I'd rethink your architecture before you consider switching languages.
- CuriouslyC 10y agoOf course anything long running is going to be run as a service via something like Celery. That being said, there are actually a lot of things you can do with SciPy for which the turnaround time isn't sufficient to justify dispatching multiple messages.
- deleted 10y ago[deleted]
- collyw 10y agoCome one, even scientific work will require a front end at some point. Not everything will be CPU intensive. And even if it is it may need some user interaction to get the task started - even if it is just uploading data to be processed offline.
- RussianCow 10y agoBut you don't need the scientific code inside your Django app—it should live in a separate process. What I'm saying is there is no need to have the scientific code directly inside the Django app.
- collyw 10y ago
- bdr 10y agoAs someone who picked Django over Rails ~10 years ago and has used it for everything since then-- I wouldn't bother. Django and Rails, like Python and Ruby, look more and more similar as time goes on. Not because they are becoming more similar, but because the web ecosystem around them has become a lot more diverse. If you want a break from Rails, learn Phoenix! Or Node, I guess. Furthermore, with the advent of fat front-ends, the utility of both of these frameworks has gone down in absolute terms. When they first came out, front-end features like form generation and HTML templating were really important, but now they're arguably better to avoid. (That's why channels are so important to the future of Django.) That said, I still like Django a lot and use it all the time. I don't want to discourage you from learning it. But I wouldn't do it because you're trying to make a leap from Rails.
- rufugee 10y agoWhat a refreshingly honest answer...thank you. It's not often you see that sort of candor. I was personally a Rails guy, then switched to learning Django, but had the experience you note...both frameworks solved many problems which aren't as relevant in this age of SPAs. I suppose if you really liked Django's ORM it might be worth it, but doubt there's a huge amount of value to be gained. YMMV.
- hrayr 10y agoI suppose if the framework, community and ecosystem are on par with each other, then the deciding factor would be the language.
- babayega2 10y agoExactly. I've chosen Django because of Python.
- morgante 10y agoIn the age of SPAs, I have actually found Django with DRF to be incredibly invaluable. The efficiency of just having to specify a few models and then getting a full REST API for them with minimal effort is tremendous.
- bedros 10y agoon top of django tutorials, I found this tech blog to be excellent source of HOW-TOs http://www.marinamele.com/django http://www.marinamele.com/django
- kibibu 10y agoMy 2 cents is that if you have a lot of Rails knowledge it's probably not worth changing. However, Django has a much better security track record, and Python is used in a lot of other fields so learning the language has broader benefits. For these reasons I absolutely recommend Django to newbies over Rails.
- collyw 10y agoBecause it will be easy to learn coming from a Rails background (or so I have heard). In terms of features I think they are pretty equal.
- babayega2 10y agoNo any reason. RoR is great. But as a personal experience, most of my pals who came from the academic area ( Python in scientific programming is beautiful...), we felt more familiar with Django because, you see, it's more straight to use Python in producing dashboards or other Web based app. But I've personally found that the main thing is to generate backend data (Json, http request...) with Django/RoR and build the fronted with Js. If you want to use in an effective manner your Python skills acquired in scientific programming to build web apps,...I would recommend Django.
- fortharris 10y agoThe online documentation will serve you well. I recently had to learn django for my new job and I must say that I enjoyed every bit of the learning process.