Django-CMS and Debug Toolbar and syncdb

Recently, I ran across an issue executing syncdb on an empty database with both Django-CMS 3 and the debug toolbar listed in the installed apps:

$ python manage.py syncdb --all
DatabaseError: relation "cms_title" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "cms_title...
                                                             ^

After some digging around with --traceback I discovered that this was caused by the debug toolbar (using the quick setup) patching the URL config when its models.py is loaded, which in turn triggers the plugin discovery to misbehave.

To get around this, follow the explicit setup as described in the toolbar’s documentation which requires that you disable the automatic patching, add a URL pattern manually to your project’s urlpatterns and the debug toolbar’s middleware.