1
0
Fork 0

Install and enable Django Debug Toolbar when in debug mode

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
merge-requests/429/head
Vasilis Tsiligiannis 2019-10-07 23:35:07 +03:00
parent 494351e2e7
commit 8710a2df3b
5 changed files with 24 additions and 6 deletions

View File

@ -46,6 +46,13 @@ LOCAL_APPS = (
'db.api',
)
if DEBUG:
DJANGO_APPS += ('debug_toolbar', )
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK':
lambda request: request.environ.get('SERVER_NAME', None) != 'testserver',
}
if AUTH0:
THIRD_PARTY_APPS += ('social_django', )
LOCAL_APPS += ('auth0login', )
@ -63,6 +70,9 @@ MIDDLEWARE = (
'csp.middleware.CSPMiddleware',
)
if DEBUG:
MIDDLEWARE = ('debug_toolbar.middleware.DebugToolbarMiddleware', ) + MIDDLEWARE
# Email
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View File

@ -30,6 +30,10 @@ if settings.AUTH0:
urlpatterns += [url(r'^', include('auth0login.urls'))]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [url(r'^__debug__/', include(debug_toolbar.urls))] + urlpatterns
urlpatterns += [
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
]

View File

@ -6,7 +6,7 @@
apipkg==1.5
atomicwrites==1.3.0
attrs==19.1.0
attrs==19.2.0
Click==7.0
coverage==4.5.4
docopt==0.6.1
@ -21,7 +21,7 @@ pluggy==0.13.0
pur==5.2.2
py==1.8.0
pyparsing==2.4.2
pytest==5.2.0
pytest==5.2.1
pytest-cov==2.7.1
pytest-django==3.5.1
pytest-forked==1.0.2

View File

@ -10,13 +10,14 @@ certifi==2019.9.11
chardet==3.0.4
defusedxml==0.6.0
dj-database-url==0.5.0
Django==1.11.24
Django==1.11.25
django-allauth==0.40.0
django-appconf==1.0.3
django-avatar==4.1.0
django-compressor==2.3
django-crispy-forms==1.7.2
django-csp==3.5
django-debug-toolbar==2.0
django-filter==2.2.0
django-jsonfield==1.3.1
django-redis-cache==2.0.0
@ -38,13 +39,13 @@ monotonic==1.5
more-itertools==7.2.0
mysqlclient==1.4.4
oauthlib==3.1.0
Pillow==6.1.0
Pillow==6.2.0
PyJWT==1.7.1
python-dateutil==2.8.0
python-decouple==3.1
python-dotenv==0.10.3
python3-openid==3.1.0
pytz==2019.2
pytz==2019.3
PyYAML==5.1.2
rcssmin==1.0.6
redis==3.3.8
@ -53,13 +54,14 @@ requests-oauthlib==1.2.0
rjsmin==1.1.0
satellitetle==0.7.0
satnogs-decoders~=1.0
sentry-sdk==0.12.2
sentry-sdk==0.12.3
sgp4==1.4
shortuuid==0.5.0
simplejson==3.16.0
six==1.12.0
social-auth-app-django==3.1.0
social-auth-core==3.2.0
sqlparse==0.3.0
Unipath==1.1
uritemplate==3.0.0
urllib3==1.24.3

View File

@ -63,6 +63,8 @@ install_requires =
simplejson~=3.16.0
uritemplate~=3.0.0
PyYAML~=5.1.0
# Debugging
django-debug-toolbar~=2.0.0
# Conflict workarounds
# django-allauth - sentry-sdk
urllib3<1.25