Scaffolding a Django project and app
Before diving deeply into the theory behind Django paradigms and HTTP requests, we’ll show you how easy it is to get a Django project up and running. After this first section and exercise, you will have created a Django project, made a request to it with your browser, and seen the response.
A Django project is a directory that contains all the data for your project – code, settings, templates, and assets. It is created and scaffolded by running the django-admin
command on the command line with the startproject
argument and providing the project name. For example, to create a Django project with the name myproject
, the command that is run is as follows:
django-admin startproject myproject
This will create the myproject
directory, which Django populates with the necessary files to run the project. Inside the myproject
directory are two files (shown in Figure 1.1):
Figure 1.1 – The project directory...