What's the best way to start learning django? [closed]

I really want to build a web application; something simple, maybe a database of Pokémon cards for instance?

I've heard excellent things about Django. Where would be the best place to start?


This is from a post I made on my blog, answering almost exactly same question. It contains many of the answers already given here, as well as some extra advice, and some of it is my personal opinion, and others may differ from me. Hopefully someone finds it useful:

Build Something

The best advice I can give is to start by building something. A typical "Hello world" for Django is a blog website, and I would also recommend starting with that. The Django framework tries to make common tasks extremely easy and simple, and a website with simple blogging functionality is a typical example. A fluent Djangonaut can code up a simple blog website in less than an hour by using all the libraries available, and therefore it's a good place to start and get a feel for how Django does things.

The Django Book

Of course, before you can just jump in and start coding, you need to get your system up and running with Django, and learn the basics. A great resource for that is the Django Book. The authors haven't worked on it in a while or kept it quite up to date (due to its young nature, Django changes quite frequently), but It's freely available online and highly recommended. Read the first few chapters on how to set up your system, how all the parts of Django fit together into the MVC model, and be amazed by how Django does things so simply that other frameworks made unnecisarily tiresome.

The Django Tutorials and Documentation

There are so many great tutorials on the Django website, that you'll almost need nothing else once you have the basics of Django down. The documentation is also fantastic, go take a look for yourself.

Pick a Django Version

For a beginner, it will be a good idea to pick a Django version, and stick with it. At the time of this writing, there are two main versions being used by most, Django 1.2 and Django 1.3, as well as the development version (the version that the Django developers work on and test changes in before it gets released as a major version). Don't use the development version when you're starting out - you're bound to run into trouble.

The big thing is that Django has existed for around four or five years now, and much of the tutorials you'll find scattered over Google will be aimed at Django 1.0 and 1.1. That's fine, and mostly not a problem, but Django's added quite a lot of functionality since then that makes most of those tutorials and code snippets obsolete. Try to stick to tutorials that are aimed at your version, where possible.

Once you've picked a version, make sure you always read the correct version of the Django documentation. You'll see on the right-hand side sidebar and in the url of the page you are on that you can change the version you're looking at. Django's documentaion is truly excellent and far beyond anything else out there, and the authors take great care to specifically state which functions are new to that version, and which are deprecated in later versions. Just make sure you're aware of that, so that you don't waste countless hours trying to make something work that's not available in your version.

Know what DRY means, and practice it

DRY: "Don't Repeat Yourself" is one of the core principles behind Django. If you find yourself copy-pasting anything in Django, there's almost certainly a better way to do it. Most programmers will know from experience why repitition like that is bad, but in short, if something in your code needs to change later on or if you made a mistake somewhere, you only need to change it in one place. That's useful, because if there is more than one place needing change, and you forget about that instance, you'll be introducing errors and bugs into your code.

Stay away from Class-based views

A new addition to Django 1.3 is a whole array of Class-based Generic Views. If you don't know what that means, don't worry. The vast majority of tutorials and books about Django won't make any mention of it, mainly because it is so new. It's a feature that is meant to lessen the repitition in creating views, thereby following the DRY principle. While it does do that to some extent, it also introduces a lot of black magic and the need to frequently go scratch around in the Django source code to see what's going on. For the beginner, that is less than ideal. In addition, the error messages as they are now provided for Class-based views often point you in the completely wrong direction. Stay away from them, and rather use functional views in the beginning, as most tutorials will tell you to. When you're a bit more used to Django and you find the repitition of functional views frustrating, look into Class-based Generic Views.

Don't start out hosting on Google App Engine

While GAE is free and great for scalable Django apps, it also introduces a lot of restrictions on your login process, and the documentation on that is extremely scarce. As a beginner, don't start out with that route, since lots of the normal Django documentation will suddenly not apply, and you won't know what to do. Rather, start with a service like epio, gondor.io, or many others . Epio's still in beta, but have a free hosting option as well (up to a certain amount of monthly usage). Developed by two of the Django core developers, I strongly recommend using them - it's comparable to Heroku for Ruby on Rails. Ep.io is closing down, but Heroku also recently added a Python hosting option.

Use StackOverflow, Ask questions

My final piece of advice is to make use of StackOverflow any time you get stuck. First off, they already have the answer to just about any question you can dream of. If you can't find it on the site, a good way to find the answer to your question is to append "stackoverflow" as part of your google search terms. Otherwise, post a question and let the Django community help you out. It's proven to be my greatest resource in learning the darker sides of Django over the last few years, apart from physically reading the Django code (which you should also do!). Good luck, and enjoy!


Build your first Django web application by reading Django tutorial.


Read through the Django book.