Creating a New Django Project

Learn to bootstrap a new Django project.

In Django, a project is an umbrella that envelops each application. For example, we can have an e-commerce Django project within which there are several applications, such as payment, order, shipping, cart, and so on. The benefit of this approach is that we can reuse each Django application inside another Django project.

When we initialize a new Django project, Django provides us with some basic files to help us get started quickly.

Install Django

To install Django, we can use the pip command. This is the package manager for Python:

pip install django

This command installs the latest version of Django.

Create a new project

Once Django is installed, we can create a new project using the following command.

django-admin startproject tdd_django .

This creates a Django project named tdd_django. Let’s go over the basic files that Django gives us by default when we create a new Django project:


  • The file runs Django management commands that create a new application, migrate the database, run tests, and so on.
  • The file contains the settings Django has already configured for us.
  • The files are where the project URLs reside.

Create a new application

We’ll create a new Django application called elibrary_app. Recall that we’re building an e-library application as the project for this course:

python startapp elibrary_app

After creating this application, we get a file inside the folder. This is the file where all our tests classes and methods will reside.

We also need to add this application as a part of the INSTALLED_APPS for this project. This allows Django to be aware of the application. This can be found in the file under the tdd_django project.




Click the “Run” button. You should see the default Django home page in the browser as the output:

Get hands-on with 1200+ tech skills courses.