Chapter 2. Views and URLconfs

In the previous chapter, I explained how to set up a Django project and run the Django development server. In this chapter, you'll learn the basics of creating dynamic web pages with Django.

Your first Django-powered page: Hello World

As our first goal, let's create a web page that outputs that famous example message: Hello World. If you were publishing a simple Hello World web page without a web framework, you'd simply type Hello world into a text file, call it hello.html, and upload it to a directory on a web server somewhere. Notice in that process you've specified two key pieces of information about that web page: its contents (the string Hello world) and its URL (for example, http://www.example.com/hello.html

Get Mastering Django: Core 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.