How to Create a Django Project

Posted on June 11, 2025

Creating a new Django project is the first step towards building a powerful web application. Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. This tutorial will guide you through the initial setup of a Django project.

Prerequisites

Before you start, make sure you have Python and pip installed on your system. You can check this by running python --version and pip --version in your terminal. It is highly recommended to use a virtual environment to manage your project's dependencies.

Step 1: Install Django

First, let's install Django. Open your terminal and run the following command:

pip install django

This will install the latest version of Django.

Step 2: Create a Django Project

Once Django is installed, you can create a new project. Navigate to the directory where you want to create your project and run:

django-admin startproject myproject

Replace myproject with the desired name of your project. This command will create a myproject directory with the basic structure of a Django project.

Step 3: Run the Development Server

Now that you have created your project, you can run the development server to see it in action. Navigate into your project directory and run the following commands:

cd myproject
python manage.py runserver

You will see output in your terminal indicating that the server is running. You can now open your web browser and go to http://127.0.0.1:8000/ to see the default Django welcome page.

Congratulations! You have successfully created a new Django project. From here, you can start building your application by creating apps, defining models, and creating views.