1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

fix Django debug toolbar after its upgrade

This commit is contained in:
AlanCoding 2019-05-14 09:01:29 -04:00
parent 2addf20907
commit 06be3a29b9
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B
3 changed files with 25 additions and 2 deletions

View File

@ -112,14 +112,17 @@ if 'django_jenkins' in INSTALLED_APPS:
PEP8_RCFILE = "setup.cfg"
PYLINT_RCFILE = ".pylintrc"
# debug toolbar and swagger assume that requirements/requirements_dev.txt are installed
INSTALLED_APPS += [ # NOQA
'rest_framework_swagger',
'debug_toolbar',
]
MIDDLEWARE += [ # NOQA
MIDDLEWARE = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
] + MIDDLEWARE # NOQA
DEBUG_TOOLBAR_CONFIG = {
'ENABLE_STACKTRACES' : True,

View File

@ -21,6 +21,12 @@ ADMINS = (
MANAGERS = ADMINS
# Enable the following lines and install the browser extension to use Django debug toolbar
# if your deployment method is not VMWare of Docker-for-Mac you may
# need a different IP address from request.META['REMOTE_ADDR']
# INTERNAL_IPS = ('172.19.0.1', '172.18.0.1', '192.168.100.1')
# ALLOWED_HOSTS = ['*']
# Database settings to use PostgreSQL for development.
DATABASES = {
'default': {

View File

@ -2,6 +2,7 @@
# All Rights Reserved.
from django.conf.urls import url, include
from django.conf import settings
from awx.main.views import (
handle_400,
handle_403,
@ -21,6 +22,19 @@ urlpatterns = [
url(r'^(?:api/)?500.html$', handle_500),
]
if settings.SETTINGS_MODULE == 'awx.settings.development':
try:
import debug_toolbar
urlpatterns += [
# for Django version 2.0
# path('__debug__/', include(debug_toolbar.urls)),
# TODO: this is the Django < 2.0 version, REMOVEME
url(r'^__debug__/', include(debug_toolbar.urls))
]
except ImportError:
pass
handler400 = 'awx.main.views.handle_400'
handler403 = 'awx.main.views.handle_403'
handler404 = 'awx.main.views.handle_404'