News for hackers. Stuff that matters.
Re:Django 1.10 released by dchuk on Monday August 01, 2016 @03:21PM (#12205140)
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?

Re:Django 1.10 released by bdr on Monday August 01, 2016 @03:44PM (#12205292)
As 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.

Re:Django 1.10 released by rufugee on Monday August 01, 2016 @04:28PM (#12205643)
What 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.

Re:Django 1.10 released by morgante on Monday August 01, 2016 @06:21PM (#12206514)
In 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.
Re:Django 1.10 released by hrayr on Monday August 01, 2016 @04:55PM (#12205871)
I suppose if the framework, community and ecosystem are on par with each other, then the deciding factor would be the language.
Re:Django 1.10 released by babayega2 on Tuesday August 02, 2016 @05:28AM (#12208728)
Exactly. I've chosen Django because of Python.
Re:Django 1.10 released by wandering2 on Monday August 01, 2016 @04:52PM (#12205842)
>front-end features like form generation and HTML templating were really important, but now they're arguably better to avoid.

Why is that?

Re:Django 1.10 released by bdr on Monday August 01, 2016 @04:59PM (#12205914)
It's the DRY principle. If you have a single-page app, the frontend needs to know how to render everything (using JS), so rendering on your backend as well is, at best, duplicated work. There may also be complications at the boundary of those regimes, like how your frontend initializes on top of server-rendered HTML.
Re:Django 1.10 released by brianwawok on Monday August 01, 2016 @11:04PM (#12207606)
At most 5% of apps should be a SPA. Seems rash to pick your only web framework on 5% of apps.
Re:Django 1.10 released by viiralvx on Monday August 01, 2016 @05:06PM (#12205994)
Not OP but I feel like it's because JavaScript has evolved enough that some of the niceties they offered before doesn't make sense. I like using Ember.js and doing client-side validations is pretty darn easy without complicated JS. Additionally, having inherited a legacy Rails project that uses `remote: true` in it's forms, it is causing more of a headache to fix these legacy issues.
Re:Django 1.10 released by senko on Tuesday August 02, 2016 @10:56AM (#12210391)
Validating data should always be done on the server. You should never, ever, trust the client.

That's not to say you can't do (or shouldn't do) form rendering, processing, error/success handling, etc. on the client-side, but the server should always have the last word on the validity of what you send.

Re:Django 1.10 released by hrayr on Monday August 01, 2016 @03:33PM (#12205221)
The 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/

[1] https://www.twoscoopspress.com/products/two-scoops-of-django...

Re:Django 1.10 released by mkane848 on Monday August 01, 2016 @04:32PM (#12205677)
Seconded 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.
Re:Django 1.10 released by ronjouch on Monday August 01, 2016 @03:29PM (#12205194)
If 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/

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/

Re:Django 1.10 released by nprescott on Monday August 01, 2016 @03:29PM (#12205198)
I 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/

Re:Django 1.10 released by kibibu on Tuesday August 02, 2016 @02:17AM (#12208086)
My 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.

Re:Django 1.10 released by heyts on Monday August 01, 2016 @03:34PM (#12205232)
If you plan to use Django as an API server, you might be interested in Lightweight Django (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.
Re:Django 1.10 released by CuriouslyC on Monday August 01, 2016 @03:39PM (#12205262)
2010 called, it wants its tech stack back ;)
Re:Django 1.10 released by __jal on Monday August 01, 2016 @04:24PM (#12205605)
Half-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.

Re:Django 1.10 released by wyldfire on Monday August 01, 2016 @10:49PM (#12207561)
Sorry, the off-lawn module depends on left-pad. :(
Re:Django 1.10 released by heyts on Monday August 01, 2016 @03:43PM (#12205285)
Admittedly 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.
Re:Django 1.10 released by varikin on Monday August 01, 2016 @03:27PM (#12205183)
I 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.
Re:Django 1.10 released by babayega2 on Tuesday August 02, 2016 @05:27AM (#12208722)
No 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.

Re:Django 1.10 released by fortharris on Wednesday August 03, 2016 @03:59AM (#12216372)
The 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.
Re:Django 1.10 released by collyw on Tuesday August 02, 2016 @04:18AM (#12208481)
Because 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.
Re:Django 1.10 released by Walkman on Monday August 01, 2016 @03:31PM (#12205208)
My suggestion: don't bother. The "less magic" things comes because of Python's explicitness (not because of Django at all).
Re:Django 1.10 released by dguaraglia on Monday August 01, 2016 @04:46PM (#12205796)
Well, 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.

Re:Django 1.10 released by bedros on Monday August 01, 2016 @05:33PM (#12206201)
on top of django tutorials, I found this tech blog to be excellent source of HOW-TOs

http://www.marinamele.com/django

Re:Django 1.10 released by CuriouslyC on Monday August 01, 2016 @03:36PM (#12205249)
There 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.
Re:Django 1.10 released by RussianCow on Monday August 01, 2016 @03:50PM (#12205344)
What 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.
Re:Django 1.10 released by Scarblac on Tuesday August 02, 2016 @08:17AM (#12209336)
> What 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 have worked on a lot of projects that involve science related stuff and Django.

Directly in the web app backend was relevant mostly for GIS apps that could take large raster data, process it based on the user's wishes, apply the right projections, apply a colormap and return an image to be shown on a map. Python has great tools for that sort of thing and it doesn't have to take much longer than rendering a HTML template does.

Other than that, the CPU intensive science-related stuff usually ran in background tasks, with Celery or otherwise. But those would still need access to the database, so why not use the same Django models for the web backend and the background tasks.

I find that once Django is part of your Python code it tends to find its way to all parts of it, through the ORM, settings files, handy admin interfaces, management commands as scripts, and so on.

Re:Django 1.10 released by CuriouslyC on Monday August 01, 2016 @04:39PM (#12205730)
Of 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.
Re:Django 1.10 released by collyw on Tuesday August 02, 2016 @04:21AM (#12208491)
Come 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.
Re:Django 1.10 released by RussianCow on Tuesday August 02, 2016 @02:43PM (#12212201)
But 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.
Re:Django 1.10 released by collyw on Thursday August 04, 2016 @09:21AM (#12225271)
There are plenty of web based scientific apps. Genome browsers for example. Why would you have those in a separate process, when its essentially a crud app?