How to Setup for Django Training
Instructions
Demo and Exercise Files
To get started, if you haven’t already, create a new folder named Webucator on your computer wherever you want. Make sure you remember where it is. Then, download the demo and exercise files either from your course setup page or from a link at the bottom of this page. Unzip them into a Django folder within the Webucator folder:
The structure should look like this:
- Webucator
- Django
- projects – This folder just contains a placeholder file. You will create some Django projects within it.
- solutions – This folder contains completed code for each lesson. When you finish a lesson, you can compare your code with the code found here.
- starter-code – We will often reference files in this directory. In most cases, this will be to save you typing out long pieces of code. These references will usually be in footnotes, so be on the watch for them.
- Django
Visual Studio Code
We use Visual Studio Code for Django development and we recommend that you do too, at least while working through these lessons, as it will make it easier for you to follow along with the many demos and exercises.
- Visit https://code.visualstudio.com and download Visual Studio Code for your operating system.
- Install Visual Studio Code:
- Windows instructions: https://code.visualstudio.com/docs/setup/windows
- Mac instructions: https://code.visualstudio.com/docs/setup/mac
- Linux instructions: https://code.visualstudio.com/docs/setup/linux
- Create a folder somewhere on your computer for storing Visual Studio Code workspaces. Name the folder vs-code-workspaces or something similar.
- Open Visual Studio Code.
- From the File menu, select Save Workspace As…
- Save the workspace as webucator-django within the workspaces folder you created earlier:
- If Visual Studio Code’s Explorer panel isn’t open, open it by clicking the files icon in the upper left. Then click the Open Folder button:
- Select the Django folder and click Add: If you are asked if you trust the authors of the files, respond that you do. If VS Code goes into Restricted Mode, click the Manage button to turn that off by indicating that you trust the authors of the workspace.
- You will now see the Django folder in Visual Studio Code’s Explorer panel:
The Python Extension
Visual Studio Code has many freely available extensions for different programming languages. Python developers should install Microsoft’s Python extension. As shown in the screenshot that follows:
- Click the Extensions icon (below the bug) on the left of the Explorer panel.
- Search for “Python”.
- If it doesn’t show that the extension is already installed, click the Install button.
Visual Studio Code Color Themes
You can customize the Visual Studio Code color theme by selecting File > Preferences > Color Theme on Windows or Code > Preferences > Color Theme on Mac. The default is a dark theme. We use a light theme for our screenshots.
Running Python
Python runs on Microsoft Windows, Mac OS X, Linux, and other Unix-like systems. The first thing to do is to make sure you have a recent version of Python installed:
- Open the terminal in Visual Studio Code by pressing Ctrl+` or selecting New Terminal from the Terminal menu.
- Run
python -V
:…/Webucator/Django> python -V Python 3.10.6
If you have Python 3.8 or later, you are all set, though we recommend you get the latest version, which is 3.10.6 at the time of this writing.
Before installing a new version of Python 3, uninstall any old versions of Python 3 that you already have installed. On Windows, you can uninstall old versions using Apps & features in System Settings. On Mac, you can delete the folder for the old versions from /Applications and /Library/Frameworks/Python.framework/Versions.
You can download Python for free at https://www.python.org/downloads/. When you run the installer on Windows, be sure to check the option to add Python to PATH. After running through the installer, restart VS Code, and then run python -V
in the terminal again to make sure Python installed correctly.
Python Versions on Macs
Your Mac may have a version of Python 2 already installed. After you install Python 3, you may find that running python -V
still shows the Python 2 version. In that case, try running python3 -V
. That should output the version of Python 3 that you have. If it does, then you should use the python3
command instead of the python
command to run Python 3.
If you would prefer to be able to use the python
command for Python 3 (and who wouldn’t), this article explains how you can map python
to python3
.
Courses, Courseware, and Class Files
This setup page is used for the following courses and courseware:
Courses
- Introduction to Django Training.
- All students should download the following class files:
- Advanced Django Training.
- All students should download the following class files:
- Django Training for Python Developers.
- All students should download the following class files:
Courseware
This is for other training companies who are licensing Webucator courseware. If you are a student in a Webucator class, you should use one of the links above or (even better) the class files link on your company landing page or main class page. If you’re not sure, please email support@webucator.com.
- Courseware: Advanced Django Training.
- Courseware: Introduction to Django Training.