We will be learning how to set up a Django project using Python.

Prerequisites
Before we start, ensure that you have installed Python and pip package manager. You can check if the installation is successful by typing these commands in your command line:

python --version
pip --version


Step 1: Developing a New Virtual Environment
In other words, virtual environments are for you to create an isolated environment for your project keeping your system dependencies separate from the project dependencies. To make this isolation, just type a few commands as follows:

python -m venv myenv


This is creating a new virtual environment in a folder called myenv. You are free to put any other name instead of myenv.

To activate the virtual environment, run the following command:

source myenv/bin/activate


This activates the virtual environment and you would notice (myenv) on your terminal.

Step 2: Django installation
Now that we have set up a virtual environment, Django can be installed by using pip. Execute the following command:

pip install Django


This will install the latest version of Django.

Step 3: Create a Django Project
The third step is to generate a Django project, and the following command will create a new one:

django-admin startproject myproject


Running this command will create a new Django project called myproject. Feel free to change the myproject part with any name of your choice.

Step 4: Develop a Django App
Django projects are composed of one or more apps. To make an additional app, type the following on your terminal:

cd myproject
python manage.py startapp myapp


Myproject folder will be the place where this new app is created and it will be called myapp.

Step 5: Configure the Database
Django uses a database to store data. By default, Django uses SQLite as the database backend. To configure the database, open the myproject/settings.py file and locate the DATABASES section. Update the section with the following information:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


This will configure Django to use SQLite as the database backend.

Step 6: Run Migrations
Before we can start using the database, we need to run migrations to create the necessary tables. To run migrations, run the following command:

python manage.py migrate


This creates the necessary tables in the database.

Step 7: Start the Development Server
With everything set, we can switch on the development server by typing this command:

python manage.py runserver


As soon as you open the project in your web browser, the development server will start and be displayed at http://127.0.0.1:80000/.

The steps to develop a Django project are therefore over in Python language. This has included installing Django, setting up a virtual environment for our application, and naming it along with our Django project. We also configured the database and ran migrations before finally starting the development server. With all this information at hand, you can now begin creating your own Django projects.