Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Command Reference

Give Feedback

00:00 Welcome to this final point that I want to address in this course. Here, you’re just going to revisit all of the commands that you used throughout this course, just as a quick reference of all the necessary commands for getting started with a Django project. Now, if you remember what you did throughout this course was you started by setting up a virtual environment. Then, you activated that virtual environment.

00:25 Next, you installed Django, pinned your dependencies, and then got started with creating a Django project. Following the Django project, you were ready to start a Django app.

00:37 And these are all the steps that you need to go through every time that you start working on a new Django project. Let’s now quickly revisit the necessary commands for each of those steps.

00:48 To set up a virtual environment, you use the command python3 -m venv and then you define the path to your virtual environment. Now remember, this is going to look a little different for Windows but the command otherwise is going to be the same. Next, you need to activate the virtual environment.

01:08 These two commands are actually a little different between Unix systems and the Windows system. In Unix, you would say source and then you give the path to the activate script, which you can find inside of your virtual environment and the bin/ folder.

01:22 And in Windows, you give the path to a similar script that is called activate.bat but it’s in a little bit of a different structure, so you’re going to have to account for that depending on which platform you are.

01:36 Once your virtual environment is activated, you are ready to install Django. You can do this with the command python3 -m pip install django.

01:47 And remember that if you want to define a specific version of Django, then you just add == and the version number of Django that you want to install. Once Django is installed, the next thing you want to do is pin your dependencies and you can do this with the pip module again and the freeze command.

02:06 So you say python3 -m pip freeze and then you pipe the output with this larger than sign (>) into requirements.txt.

02:17 This is a convention to use requirements.txt as the name for this file, but I suggest to stick with it.

02:24 Once you’ve pinned your dependencies, you’re ready to set up a Django project and you can do this with the django-admin command and then startproject and then you pass a project name.

02:35 Again, remember you could put a dot (.) here at the end to skip the creation of one additional directory.

02:44 Once you have your Django project set up, you’re ready to start a Django app. The command for this is python3 startapp and then the name of your app. And for each consecutive Django app that you want to create inside of your Django project—there can be more than one—you will just use the same command and pass it a new app name.

03:06 And that’s all! So once you’re at this point, you’re ready to get started working on your project, and let’s recap quickly what you did throughout this course in the final lesson of this course. See you there!

Become a Member to join the conversation.