Coders' Guidebook

How to install Django and create a new project

Django is a Python-based web framework. It can be used to build scalable websites and applications quickly and securely. In this tutorial, we will explore how to set up Django and lay the groundwork for a new project.

Installing Django

To begin, open the Command Prompt app (command line for Linux users, terminal for Mac users). Set the working directory to your project folder then activate the virtual environment as described in the previous tutorial. Next, type the following command to install Django in the working directory:

pip install django

If Django is successfully installed then you should see a message similar to this (some of the package numbers may be different):

Installing collected packages: pytz, sqlparse, asgiref, django
Successfully installed asgiref-3.2.3 django-3.0 pytz-2019.3 sqlparse-0.3.0

Start a new Django project

Once the installation is complete, create a new Django project using a command similar to this:

django-admin startproject website

Replace the word 'website' with the name of your Django project.

Starting a Django project will create a new subfolder in the working directory along with several Python (.py) files. We will explore how to use these files in upcoming tutorials.

<<< Previous

Next >>>