Skip to content

Commit afd917c

Browse files
committed
Add Django debug toolbad
1 parent 3fb0f83 commit afd917c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

sandbox/settings.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
2+
import socket
33

44
DEBUG = True
55

@@ -13,6 +13,7 @@
1313
'PORT': '', # Set to empty string for default. Not used with sqlite3.
1414
}
1515
}
16+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
1617

1718
# Local time zone for this installation. Choices can be found here:
1819
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -80,11 +81,8 @@
8081
TEMPLATES = [
8182
{
8283
'BACKEND': 'django.template.backends.django.DjangoTemplates',
84+
'APP_DIRS': True,
8385
'OPTIONS': {
84-
'loaders': [
85-
'django.template.loaders.filesystem.Loader',
86-
'django.template.loaders.app_directories.Loader',
87-
],
8886
'context_processors': [
8987
'django.template.context_processors.debug',
9088
'django.template.context_processors.request',
@@ -96,6 +94,7 @@
9694
]
9795

9896
MIDDLEWARE = (
97+
'debug_toolbar.middleware.DebugToolbarMiddleware',
9998
'django.middleware.common.CommonMiddleware',
10099
'django.contrib.sessions.middleware.SessionMiddleware',
101100
'django.middleware.csrf.CsrfViewMiddleware',
@@ -119,9 +118,11 @@
119118
'dummyapp',
120119
'django_rq',
121120
'cacheback',
121+
'debug_toolbar',
122122
)
123123

124-
INTERNAL_IPS = ('10.0.2.2',)
124+
_, _, ips = socket.gethostbyname_ex(socket.gethostname())
125+
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips]
125126

126127
# A sample logging configuration. The only tangible logging
127128
# performed by this configuration is to send an email to

sandbox/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from django.urls import path
2+
from debug_toolbar.toolbar import debug_toolbar_urls
23

34
from dummyapp import views
45

56

67
urlpatterns = [
78
path('', views.index, name='index'),
8-
]
9+
] + debug_toolbar_urls()

0 commit comments

Comments
 (0)