We use supervisord to run the Django runserver. This means if you want to access the management server from a shell to run things like ipdb you still can.

Using ipdb

As with ipdb normally just add a line in your code at the relevant point:

import ipdb; ipdb.set_trace()

Next connect to the running web container:

make debug

This will bring the Django management server to the foreground and you can interact with ipdb as you would normally. To quit you can just type Ctrl+c.

All being well it should look like this:

$ make debug
docker exec -t -i olympia_web_1 supervisorctl fg olympia
11:02:08 py.warnings:WARNING /opt/rh/python27/root/usr/lib/python2.7/site-packages/jwt/ DeprecationWarning: The verify parameter is deprecated. Please use options instead.
'Please use options instead.', DeprecationWarning)
[21/Oct/2015 11:02:08] "PUT /en-US/firefox/api/v4/addons/%40unlisted/versions/0.0.5/ HTTP/1.1" 400 36
Validating models...

0 errors found
October 21, 2015 - 13:52:07
Django version 1.6.11, using settings 'settings'
Starting development server at
Quit the server with CONTROL-C.
[21/Oct/2015 13:57:56] "GET /static/img/app-icons/16/sprite.png HTTP/1.1" 200 3810
13:58:01 py.warnings:WARNING /opt/rh/python27/root/usr/lib/python2.7/site-packages/celery/task/ CDeprecationWarning:
    celery.task.sets and TaskSet is deprecated and scheduled for removal in
    version 4.0. Please use "group" instead (see the Canvas section in the userguide)

> /code/src/olympia/browse/
    147     import ipdb;ipdb.set_trace()
--> 148     TYPE = amo.ADDON_THEME
    149     if category is not None:

ipdb> n
> /code/src/olympia/browse/
    148     TYPE = amo.ADDON_THEME
--> 149     if category is not None:
    150         q = Category.objects.filter(, type=TYPE)



Logs for the celery and Django processes can be found on your machine in the logs directory.

Using the Django Debug Toolbar

The Django Debug Toolbar is very powerful and useful when viewing pages from the website, to check the view used, its parameters, the SQL queries, the templates rendered and their context.

To use it please see the official getting started docs:

Impact on performance

You must know that using the Django Debug Toolbar will slow the website quite a lot. You can mitigate this by deselecting the checkbox next to the SQL panel.

Also, please note that you should only use the Django Debug Toolbar if you need it, as it makes CSP report only for your local dev.

CSP policies

You might have to disable CSP by setting CSP_REPORT_ONLY = True in your local settings because django debug toolbar uses “data:” for its logo, and it uses “unsafe eval” for some panels like the templates or SQL ones.