15 Key Resources to Learn Django
Learning Python and Django is easy if you have the right resources at your fingertips.
Coming from pretty much only having studied programming in school, I started working as a developer at Yipit with almost no web programming experience. In a little fewer than ten weeks, I’ve become comfortable navigating and making large changes to the whole Python/Django application code as well as contributing new features (interested in learning Django at Yipit? Join us!).
While the learning process wasn’t gut-wrenching, I certainly ran into some hefty roadblocks that would have been almost insurmountable had coworkers not pointed me to the resources below:
Comparing Python to Other Languages
If you know another programming language already, you can easily leverage that knowledge by finding out the differences between Python and that other language, and then by focusing in on learning those differences.
1. Python & Java - A Side by Side Comparison I knew enough Java already from college, and doing some quick reading online saved me a lot of time. I would highly recommend reading this article if you know Java already. It helped me form a mental road-map of what areas to focus on.
2. Also, the Python wiki has a good collection of comparisons of Python to other programming languages.
Python Style
Learning Python syntax is one thing, learning “Pythonic” style is quite another. Regardless of whether you end up coding like this, it’s at least a good idea to understand what is idiomatic – it can save you time when reading other people’s code.
3. Code Like A Pythonista by David Goodger– This article gives a good rundown of how to write readable and stylistic Python code that takes advantage of the dynamic features of the language.
4. Google Python Style Guide – Some good standard practices.
Advanced Python Features
Certain programming concepts in Python just don’t exist in Java, for instance closures and meta-programming, and they were a bit tough for me to pick up. The following articles gave me a good deal of insight into these concepts.
5. What Is A Metaclass in Python - A detailed explanation of a pretty tough topic in Python. Django uses quite a bit of metaclasses, and if you get a solid grasp on metaclasses, you’ll save yourself a lot of time going through models and forms.
6. Hidden Features of Python - A great compilation of answers on Stack Overflow.
7. A Few of My Favorite Python Things - An opinionated walk-through some of the cool features of Python
Python/Django Tutorials
For a more complete introduction, the following tutorials will bring you up to speed and are a good review if you know some programming already. The important thing is to give the exercises a try.
8. Google’s Python Class - A colleague of mine who also just recently started programming in Python recommends this resource as a quick way to jump into Python programming which has a great mix of video lectures and notes and practical examples.
9. Writing your first Django app on djangoprojects - This canonical tutorial on Django that lets you get your hands dirty and set up a Django project.
Best of Django Documentation
While reading documentation isn’t the most glamorous endeavor in the world, a few sections of Django’s documentation are worth reading for themselves.
10. Managers / Querysets - These sections give a good deal of insight into how Django interacts with relational databases, which seems quite magical. Just always be mindful of the actual queries you’re sending out or else they’ll come back to bite you hard.
11. Request-Response / User - If you’ve never worked with an HTTP request, these sections are very helpful as an introduction. Also, the notion of a User along with all the authentication that goes with it come free with Django. Lucky you.
12. Views / Templates - A good introduction on how the application-level code connects to the client-side HTML/JS/CSS code.
Reading Code from Successful Django Sites
Everything said and done, there’s not a great substitute for reading code. I read through most of Yipit’s codebase to get a sense for how Django is used in a production environment. You might not have access to such a codebase, however, you can find a plethora of Django-powered sites that have open-sourced their codebase.
13. Django Sites - A great resource for access to dozens of sites that have their source open for you to browse through.
Python Tools
Having the right tools at your disposal can make your life a lot easier by saving you hours of going down the wrong path. However, especially when debugging, I’ve found that the best thing to have is a healthy skepticism for your own code.
14. IPython - Although not specific to Django, IPython is a huge improvement over the standard Python shell. With its tab complete feature, it saves me a few extra seconds of distraction whenever I can’t remember a function or module name.
15. PDB / iPDB - The Python debugger tool has been incredibly helpful to me when going through a new piece of code. It gives you the power to stop code at arbitrary points and inspect the variables at those points. iPDB gives you the power of PDB along with the features of iPython.
These fifteen resources really got me going with Django. And while I’m no Django pro just yet, I still think how amazing it is that I picked up so much knowledge in just a short span of time.
Mingwei Gu is a Developer at Yipit. @mwgu
Join the discussion on Hacker News