Locked lesson.
About this lesson
In this video, you'll learn how to install Django straight from the terminal. You'll also learn how to use Pip Freeze to see what has been installed inside and outside your virtual environment.
Exercise files
Download this lesson’s related exercise files.
Install Django & Pip Freeze Inside and Outside The Virtual Environment.docx57.3 KB Install Django & Pip Freeze Inside and Outside The Virtual Environment - Solution.docx
55.7 KB
Quick reference
Install Django & Pip Freeze Inside and Outside The Virtual Environment
In this video we'll install Django into our terminal.
When to use
You need to install Django inside of your virtual environment once, every time you create a new project.
Instructions
To install Django from within your virtual environment, use the command:
pip install django
To make sure it was installed correctly, use the command:
pip freeze
Hints & tips
- pip install django
- pip freeze
- 00:04 In this video we′re going to download and install Django.
- 00:07 So, installing Django is really, really easy,
- 00:10 we′re going to actually do it straight from our terminal.
- 00:14 You notice I'm in my c/mywebsite directory and
- 00:17 you notice that our virtual environment is turned on.
- 00:20 It′s very important that you′re in your virtual environment.
- 00:24 So before we install Django, I want to show you something really quickly.
- 00:27 You can see what sorts of things have already been installed
- 00:31 in your virtual environment by typing the command pip freeze.
- 00:35 And if we do this, nothing happens.
- 00:37 It just doesn't do anything.
- 00:40 Well, that's because we haven't actually installed anything inside of our virtual
- 00:43 environment yet, so there's nothing to see.
- 00:45 But after we install Django, we'll go ahead and do the pip freeze thing again.
- 00:49 And you'll see that in fact, Django has been installed, and that's kind of cool.
- 00:52 Along the way from time to time, depending on what you're doing with Django,
- 00:56 you'll have to install other modules and other Python things.
- 01:00 And you can always use that pip freeze command to see what's been installed in
- 01:04 your virtual environment up until now.
- 01:06 So, all right, now let's go ahead and install Django.
- 01:09 And to do that, we're going to use pip again and
- 01:12 pip is the Python installation program pip, Python installation program.
- 01:16 What PIP does, is it installs things on your computer?
- 01:20 It goes out onto the internet, grabs them, downloads them and
- 01:23 installs them all for you.
- 01:25 And it's just really easy and really great to use.
- 01:28 It's just a nice Python thing.
- 01:29 So we're going to go ahead and take advantage of that and
- 01:32 use it to install Django.
- 01:33 Now you can go to the Django website and
- 01:36 download it like you would any other program.
- 01:38 Like we installed the Sublime Text Editor and we installed Python itself and
- 01:42 we installed the Git Bash terminal.
- 01:43 But this is the better way to do it.
- 01:45 You really want to do it from the command prompt.
- 01:47 You don't want to go to the Django website and download it from there.
- 01:50 So, all right, let's go ahead and pip install django.
- 01:55 Now before I do this, this will install the most current version.
- 01:59 If you have a different version that you want to download for a specific project,
- 02:04 if you've created a Django project a couple of years ago,
- 02:07 and it was using an older version of Django, and
- 02:09 you have to use that same older version to work on it.
- 02:12 To do that, you would just type in two equal to signs.
- 02:15 And then designate whatever version you want to download.
- 02:18 So if you wanted to download for instance 2.0.1, you would just do that.
- 02:25 So we don't want to do that.
- 02:26 We just want to download and install the latest version.
- 02:28 So we could just pip install django and hit Enter.
- 02:32 And you see it's collecting Django.
- 02:34 It's also collecting sql parse.
- 02:36 That's a database thing, and it's also collecting pitz.
- 02:40 That's a Python time zone file.
- 02:42 Django uses that for different things.
- 02:47 And you can see it's installing these packages sqlparse,
- 02:51 Python time zone, that's asgiref, and Django itself.
- 02:55 So we've successfully installed this django 3.0,
- 03:01 python tz 2019 and sqlparser 3.0 now it's installed Django 3.0.
- 03:09 This just came out.
- 03:11 If this number changes by the time you watch this video, no big deal,
- 03:14 just go ahead download the latest version.
- 03:15 And you should be good to go.
- 03:16 So, okay, it looks like it's been installed successfully.
- 03:20 Let's clear our screen.
- 03:21 But let's run that pip freeze command, just to make sure.
- 03:25 And when we do we see these are the things that we just now install the sqlparser,
- 03:31 pytz, django itself version 3.0.
- 03:34 And then this thing as well.
- 03:36 Pip freeze.
- 03:38 PIP is a great tool to use.
- 03:40 You can uninstall things if you want, you could go pip uninstall, and
- 03:43 then just django, right?
- 03:45 If you want it to uninstall Django, for some reason you can do that.
- 03:48 I don't recommend you do that now.
- 03:49 Cause we definitely want to use Django.
- 03:52 So Django has been installed.
- 03:54 We're ready to go in the next video, we'll go ahead and start our project.
Lesson notes are only available for subscribers.