- HD
- 720p
- 540p
- 360p
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
In this lesson, you'll learn how to setup a Virtual Environment so you can run Django projects and commands without affecting the rest of your computer.
Exercise files
Download this lesson’s related exercise files.
Set Up A Virtual Environment57.2 KB Set Up A Virtual Environment - Solution
57.7 KB
Quick reference
Set Up A Virtual Environment
To use Django, we create a virtual environment. Inside that environment, we'll install Django and other tools that we'll need.
When to use
Set up a virtual environment once per project. Then, every time you work on your project, make sure to turn on your virtual environment.
Instructions
First, create a new directory called mywebsite using the command:
mkdir /c/mywebsite
To move into that directory, use the command:
cd /c/mywebsite
To create a virtual environment, use the command:
python -m venv virtual
To turn on your virtual environment, use the command:
source virtual/Scripts/activate
Hints & tips
- To create a virtutual environment: python -m venv virtual
- To turn on a virtual environment: source virtual/Scripts/activate
Lesson notes are only available for subscribers.