Last time around, we installed Django and started building a blog application. We got Django’s built-in admin system up and running and explored some third-party libraries like the django-tagging project.
So far we have some cool administrative tools, but no website for the rest of the world to see. This time around, we’ll work on displaying our content to the world by building the URL patterns and constructing some “views” — a term with a very specific meaning within the Django framework.
Everything we’re going to do will make more sense if you understand how Django processes your visitor’s request. We went over some of this in our introduction, but here’s a quick refresher course.
This is part 4 of Webmonkey’s introductory Django tutorial. If you’re arriving here to learn about getting started with Django, start back at the beginning with Lesson 1.
When we left off last time, we had defined some URLs for our blog and constructed a custom view to handle displaying posts by tag. If you point your browser to our development URL at this point, (http://127.0.0.1:8000/blog/) you’ll still see a Django error page complaining that the template blog/list.html does not exist. Don’t panic, it’s true — we haven’t created it yet.
It’s time to tackle the last aspect of Django, the template syntax.
Welcome back! If you’ve been following along our entire series of tutorials on building sites with Django, you’ll (by now) have built a blog website with date-based archives and some nice extras such as tagging and Markdown support.
Along the way, we also ported our app over to the new Newforms Admin version of Django so that we’ll be all ready to go when Django hits version 1.0. If you haven’t done that yet, be sure to do it before we continue.
However, what we’ve created is not much different than what one could do with WordPress or another out-of-the-box blogging tool. That’s OK for a learning project. But now we’re getting close to being experts, we are going to explore some territory beyond what we can do with pre-built tools.
Let’s build something a little more advanced. Let’s build a microblog.