Chapter 3. The Basics of Dynamic Web Pages

In the previous chapter, we explained how to set up a Django project and run the Django development server. Of course, that site doesn't actually do anything useful yetall it does is display the "It worked!" message. Let's change that. This chapter introduces how to create dynamic Web pages with Django.

Your First View: Dynamic Content

As our first goal, let's create a Web page that displays the current date and time. This is a good example of a dynamic Web page, because the contents of the page are not static; rather, the contents change according to the result of a computation (in this case, a calculation of the current time). This simple example doesn't involve a database or any sort of user inputjust ...

Get The Definitive Guide to Django: Web Development Done Right now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.