File tree Expand file tree Collapse file tree 5 files changed +26
-2
lines changed Expand file tree Collapse file tree 5 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 48
48
"general" ,
49
49
"simple_history" ,
50
50
]
51
+
52
+ # Add django-extensions to the installed apps if DEBUG is True
51
53
if DEBUG :
52
54
INSTALLED_APPS += [
53
55
"django_extensions" ,
56
+ "debug_toolbar" ,
54
57
]
55
58
56
59
AUTH_USER_MODEL = "users.CustomUser"
68
71
"django.middleware.locale.LocaleMiddleware" ,
69
72
]
70
73
74
+ # Add debug toolbar middleware
75
+ if DEBUG :
76
+ MIDDLEWARE .insert (0 , "debug_toolbar.middleware.DebugToolbarMiddleware" )
77
+
71
78
ROOT_URLCONF = "app.urls"
72
79
73
80
TEMPLATES = [
104
111
}
105
112
}
106
113
114
+ # toolbar settings
115
+ if DEBUG :
116
+ DEBUG_TOOLBAR_CONFIG = {
117
+ "IS_RUNNING_TESTS" : False ,
118
+ "SHOW_TOOLBAR_CALLBACK" : lambda request : DEBUG ,
119
+ }
120
+
121
+ INTERNAL_IPS = [
122
+ "host.docker.internal" ,
123
+ ]
124
+
125
+ # Check if the application is under testing
107
126
if "test" in sys .argv or "test_coverage" in sys .argv : # Covers regular testing and django-coverage
108
127
DATABASES ["default" ]["ENGINE" ] = "django.db.backends.sqlite3"
109
128
144
163
# Static files (CSS, JavaScript, Images)
145
164
# https://docs.djangoproject.com/en/5.0/howto/static-files/
146
165
147
-
166
+ # Static files (CSS, JavaScript, Images)
148
167
if DEBUG :
149
168
_STATICFILES_BACKEND = "django.contrib.staticfiles.storage.StaticFilesStorage"
150
169
else :
151
170
_STATICFILES_BACKEND = "whitenoise.storage.CompressedManifestStaticFilesStorage"
152
171
153
-
154
172
STATIC_URL = "/static/"
155
173
STATICFILES_DIRS = [
156
174
BASE_DIR / "static" ,
192
210
if "test" in sys .argv :
193
211
DEBUG = False
194
212
213
+ # Logging configuration
195
214
if DEBUG :
196
215
LOGGING = {
197
216
"version" : 1 ,
Original file line number Diff line number Diff line change 37
37
38
38
if settings .DEBUG :
39
39
urlpatterns += static (settings .MEDIA_URL , document_root = settings .MEDIA_ROOT )
40
+ urlpatterns .append (path ("__debug__/" , include ("debug_toolbar.urls" )))
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ services:
29
29
- " 8000:8000"
30
30
depends_on :
31
31
- db
32
+ extra_hosts :
33
+ - " host.docker.internal:host-gateway"
32
34
environment :
33
35
# TODO: dollar signs in the KEY are interpolated, therefore escaped here
34
36
# with double "$$". Maybe move to .env file to simplify?
Original file line number Diff line number Diff line change 1
1
-r requirements.txt
2
+ django-debug-toolbar
2
3
django-extensions
3
4
pygraphviz
4
5
ruff
Original file line number Diff line number Diff line change 1
1
-r requirements.txt
2
+ django-debug-toolbar
2
3
django-extensions
3
4
ruff
4
5
faker
You can’t perform that action at this time.
0 commit comments