Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Django Debug Toolbar in development #5464

Merged
merged 1 commit into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions readthedocs/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def LOGGING(self): # noqa - avoid pep8 N802
logging['disable_existing_loggers'] = False
return logging

@property
def INSTALLED_APPS(self):
apps = super().INSTALLED_APPS
apps.append('debug_toolbar')
return apps

@property
def MIDDLEWARE(self):
middlewares = list(super().MIDDLEWARE)
middlewares.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware')
return middlewares


CommunityDevSettings.load_settings(__name__)

Expand Down
5 changes: 5 additions & 0 deletions readthedocs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
if getattr(settings, 'ALLOW_ADMIN', True):
groups.append(admin_urls)
if getattr(settings, 'DEBUG', False):
import debug_toolbar

debug_urls += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
groups.append(debug_urls)

urlpatterns = reduce(add, groups)
3 changes: 3 additions & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ django-cors-middleware==1.3.1

# User agent parsing - used for analytics purposes
user-agents<1.2.0

# Required only in development and linting
django-debug-toolbar==1.11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put this in another file like https://github.com/stsewd/readthedocs.org/blob/b856e791b6be6cff68a98efd1422f30136c2d856/requirements/testing.txt#L27-L29? Mostly because this will be installed in production too, we are not going to activate it, but looks like a dead package to have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I put it here is that it is required for testing, development, and linting. Currently only the default requirements.txt file (which then loads pip.txt) is used in development according to our documentation.