Writing your first Django app, part 1

Chapter 3: Views and URLconfs
In the previous chapter, we 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. With Django, you specify those same two things, but in a different way. Your First View Within the mysite directory that django-admin.py startproject made in the last chapter, create an empty file called views.py. Our “Hello world” view is simple. from django.http import HttpResponse def hello(request): return HttpResponse("Hello world") Let’s step through this code one line at a time: Your First URLconf We made two changes here: Note Your Python Path Hooray!
Related:
Related: