Workshop: Test-Driven Web Development with Django¶
Why test-driven development?¶
When creating a new application, at first you may not need tests. Tests can be difficult to write at first and they take time, but they can save an enormous amount of manual troubleshooting time.
As your application grows, it becomes more difficult to grow and to refactor your code. There’s always the risk that a change in one part of your application will break another part. A good collection of automated tests that go along with an application can verify that changes you make to one part of the software do not break another.
You do not need to be a Django expert to attend this workshop or to find this document useful. However, the goal of getting a working website with tests in a single day is a lofty one and so we ask that attendees come with Python and Django installed. We also encourage people to go through the Django tutorials beforehand in order to get the most out of the workshop.
The Project: building a blog¶
The right of passage for most web developers is their own blog system. There are hundreds of solutions out there. The features and requirements are generally well understood. Writing one with TDD becomes a kind of code kata that can help you work through all kinds of aspects of the Django framework.
- Getting started
- Views and Templates
- More Views
- The Testing Game
- Custom template tags
- Database Migrations with Django South
- Adding Gravatars
Getting Help & Contributing¶
Markdown source files and working code examples for these tutorials can be found on Github. If you found a bug or have a suggestion to improve or extend the tutorials, please open an issue or a pull request.
These tutorials are provided under a Creative Commons license (CC BY-SA 3.0).