Skip to content

Commit e7bff7b

Browse files
committed
➕ [#538] Add django-silk for performance profiling
1 parent e5268e8 commit e7bff7b

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

requirements/dev.in

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ bump-my-version
88
# Debug tooling
99
django-debug-toolbar
1010
django-extensions
11+
django-silk
12+
whitenoise
1113

1214
# Documentation
1315
sphinx

requirements/dev.txt

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ attrs==20.3.0
4242
# -r requirements/ci.txt
4343
# glom
4444
# jsonschema
45+
autopep8==2.3.2
46+
# via django-silk
4547
babel==2.16.0
4648
# via
4749
# -c requirements/ci.txt
@@ -206,6 +208,7 @@ django==4.2.19
206208
# django-sendfile2
207209
# django-sessionprofile
208210
# django-setup-configuration
211+
# django-silk
209212
# django-simple-certmanager
210213
# django-solo
211214
# django-two-factor-auth
@@ -326,6 +329,8 @@ django-setup-configuration==0.7.1
326329
# -c requirements/ci.txt
327330
# -r requirements/ci.txt
328331
# open-api-framework
332+
django-silk==5.3.2
333+
# via -r requirements/dev.in
329334
django-simple-certmanager==1.4.1
330335
# via
331336
# -c requirements/ci.txt
@@ -448,6 +453,8 @@ glom==23.5.0
448453
# -c requirements/ci.txt
449454
# -r requirements/ci.txt
450455
# mozilla-django-oidc-db
456+
gprof2dot==2024.6.6
457+
# via django-silk
451458
h11==0.14.0
452459
# via httpcore
453460
httpcore==1.0.7
@@ -637,6 +644,7 @@ pycodestyle==2.12.1
637644
# via
638645
# -c requirements/ci.txt
639646
# -r requirements/ci.txt
647+
# autopep8
640648
# flake8
641649
pycparser==2.20
642650
# via
@@ -881,6 +889,7 @@ sqlparse==0.5.0
881889
# -r requirements/ci.txt
882890
# django
883891
# django-debug-toolbar
892+
# django-silk
884893
tblib==1.7.0
885894
# via
886895
# -c requirements/ci.txt
@@ -975,6 +984,8 @@ webtest==2.0.35
975984
# django-webtest
976985
wheel==0.42.0
977986
# via pip-tools
987+
whitenoise==6.9.0
988+
# via -r requirements/dev.in
978989
wrapt==1.14.1
979990
# via
980991
# -c requirements/ci.txt

src/objects/conf/dev.py

+9
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@
102102
r"django\.db\.models\.fields",
103103
)
104104

105+
#
106+
# DJANGO-SILK
107+
#
108+
if config("PROFILE", default=False, add_to_docs=False):
109+
INSTALLED_APPS += ["silk"]
110+
MIDDLEWARE = ["silk.middleware.SilkyMiddleware"] + MIDDLEWARE
111+
security_index = MIDDLEWARE.index("django.middleware.security.SecurityMiddleware")
112+
MIDDLEWARE.insert(security_index + 1, "whitenoise.middleware.WhiteNoiseMiddleware")
113+
105114
if "test" in sys.argv:
106115
NOTIFICATIONS_DISABLED = True
107116

src/objects/urls.py

+4
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,7 @@
7979
urlpatterns = [
8080
path("__debug__/", include(debug_toolbar.urls)),
8181
] + urlpatterns
82+
83+
84+
if apps.is_installed("silk"):
85+
urlpatterns += [path(r"silk/", include("silk.urls", namespace="silk"))]

0 commit comments

Comments
 (0)