Welcome to the tutorial! I really appreciate the time you've spent so far and the time you spend in the future on this tutorial.
The purpose of this tutorial is to expose you to some of the tools available to you as a Djangonaut to aid you in your debugging adventures.
If you didn't attend the talk or would like to view the slides, you can find them here.
This tutorial is written to give you the experience of working on a real project. There are tests and adjacent functionality. The tests are written so that they all pass for each lab, which means they confirm the bugs you will be finding.
I suggest reviewing the Project Overview page which has high level information on the models. It should make it easier to understand the project.
Regarding debugging methods, a very useful one is to bisect commits or find the last known good version, then compare what doesn't work. That is very easy to do in this environment, but I strongly suggest that you don't do that unless you're stuck.
There are a total of 7 labs, numbered 1.1-1.3, 2.1-2.4 (it made sense at the time). Each is structured with a Report, a set of Facts, an Investigation section, a Conclusion and finally Further Consideration.
I suggest using the Investigation section, but if you'd like to avoid any hints in your debugging effort then stop reading after the Report and Facts sections.
The Conclusion section will have the solution(s) while Further Consideration is reserved for asking you to reflect on your own projects.
This section will provide you with the minimal setup for this tutorial. If you have a preference on setting up a project differently and know that it works, go for it! Do what you're most comfortable.
- Have Python 3.8+ installed. My assumption is that you have your own setup decided upon. However, if you're unsure where to go for this, I'd recommend using https://www.python.org/downloads/ for today.
- From the terminal or command prompt, clone the project.
If you don't have a SSH key setup, you can use:
git clone [email protected]:tim-schilling/debug-tutorial.git
If you don't have git installed, you can download the zip file and unpack it.git clone https://github.com/tim-schilling/debug-tutorial.git
- Change into project directory
If you downloaded the zip file, you'll need to
cd debug-tutorial
cd
to the location where you unpacked the archive.
If you are comfortable on Windows with Python and have setup multiple projects, ignore this warning. Do what's comfortable.
If not, I highly recommend using the Windows Subsystem for Linux (docs). If you do, the rest of the instructions will work for you. If you don't have access to that please scroll down to Windows non-WSL Setup.
- From the terminal, create a virtual environment. (venv docs)
python -m venv venv
- Active the virtual environment.
source venv/bin/activate
- Install the project dependencies.
pip install -r requirements.txt
- Create a new .env file.
If you use this for literally anything but this tutorial, please change the
cp .env.dist .env
SECRET_KEY
value in your.env
file. - Create the database for the project.
python manage.py migrate
- Verify the tests currently pass, if they don't and you're not sure why,
please ask.
python manage.py test
- Create the fake data. This will take a few minutes.
python manage.py fake_data
- Create your own super user account. Follow the prompts.
python manage.py createsuperuser
- Run the development web server.
python manage.py runserver
- Verify the following pages load:
- Log into the admin (link) with your super user.
- Verify the following pages load:
BOOM! You're done with the setup. Now that we've accomplished the boring stuff, let's get to the dopamine rushes. I mean the bugs.
Proceed to Lab 1.
- From the command prompt, create a virtual environment.
python3 -m venv venv
- Activate the project
.\venv\Scripts\activate
- Install the project dependencies.
pip install -r requirements.txt
- Create a new .env file.
If you use this for literally anything but this tutorial, please change the
copy .env.dist .env
SECRET_KEY
value in your.env
file. - Create the database for the project.
python -m manage migrate
- Verify the tests currently pass, if they don't and you're not sure why,
please ask.
python -m manage test
- Create the fake data. This will take a few minutes.
python -m manage fake_data
- Create your own super user account. Follow the prompts.
python -m manage createsuperuser
- Run the development web server.
python -m manage runserver
- Verify the following pages load:
- Log into the admin (link) with your super user.
- Verify the following pages load:
Proceed to Lab 1.