0 of 3 lessons complete (0%)

Installing and Setting up Django and Python

This is a preview lesson
Register or sign in to take this lesson.

This guide[4] uses Visual Studio Code and Python[5] to install and develop a website based on the Django framework.

Install a version of Python 3, make sure that you add Python to your PATH variable[1] during installation if you are on Windows.

If you are going to use Github to handle version control[6] and the repository[2] create a repository now.

Open this folder in VS Code.

Create a Virtual Environment[3] in Python for this project[7].

Open a New Terminal (Terminal > New)

Enter the following to create the Virtual Environment named .django-venv

py -3 -m venv .django-venv

Click Yes to select this as the workspace folder.

Press Win+Shift+P to open the Command Palette (View > Command Palette).

Search for Python: Select Interpretor

Choose use Python from the default path.

Start a new Terminal with the Virtual Environment active.

You should see (.django-venv) before the folder if it is active.

Upgrade pip first if needed.

python -m pip install --upgrade pip

Next install the Django framework.

python -m pip install django

By default a django project has some core files and a django administration panel.

First we need[8] to create the django app

We use django-admin for this.

In the terminal run the following code, this will create a django app/project called example_web_project. Change this to the name of your project.

django-admin startproject example_web_project

This will create some core files for the project.

Create an empty database by entering the following command

python manage.py migrate

You should see some installation messages.

To run the server enter the following line into the terminal:

python manage.py runserver

You should see this message:

If you enter the url[9] http:/127.0.0.1:8000 you should get a webpage running.

When you visit the page you will see:

Congratulations, you have now installed and setup django.

Later lessons will customise this website.

Terms definitions
2. repository. Used in version control systems to refer to a place or location that contains files for a project.
3. Environment. The surroundings of, and influences on, a particular item of interest. Electronic environments can be defined as functional combinations of hardware and embedded software in the real world – that is, circuits, prototypes or products. In Technology, physical environment[3] commonly refers to the location of the specific practice or the place where a final outcome[13] will be located. In […]
4. guide. A user guide, document or tutorial to explain[12] how to complete a task.
5. Python. A type of programming[11] language. It is one of many high-level, general-purpose programming languages. It was first released in 1991
Terms definitions
1. variable. This guide uses Visual Studio Code and Python to install and develop a website based on the Django framework. Install a version of Python 3, make sure that you add Python to your PATH variable during installation if you are on Windows. If you are going to use Github to handle version control and the […]
2. repository. This guide uses Visual Studio Code and Python to install and develop a website based on the Django framework. Install a version of Python 3, make sure that you add Python to your PATH variable during installation if you are on Windows. If you are going to use Github to handle version control and the […]
3. Environment. This guide uses Visual Studio Code and Python to install and develop a website based on the Django framework. Install a version of Python 3, make sure that you add Python to your PATH variable during installation if you are on Windows. If you are going to use Github to handle version control and the […]
4. guide. This guide uses Visual Studio Code and Python to install and develop a website based on the Django framework. Install a version of Python 3, make sure that you add Python to your PATH variable during installation if you are on Windows. If you are going to use Github to handle version control and the […]
5. Python. This guide uses Visual Studio Code and Python to install and develop a website based on the Django framework. Install a version of Python 3, make sure that you add Python to your PATH variable during installation if you are on Windows. If you are going to use Github to handle version control and the […]