DSF Tutorial
Instructions
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
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. 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.9.5
If you have Python 3.7 or later, you are all set, though we recommend you get the latest version, which is 3.9.5 at the time of this writing.
You can download Python for free at https://www.python.org/downloads/. After running through the installer, run python -V
in the terminal again to make sure Python installed correctly.
Your Mac will likely 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
.