Skip to content

Commit

Permalink
Merge pull request #1011 from maykinmedia/feature/add-django-silk
Browse files Browse the repository at this point in the history
🔧 Setup silk profiling
  • Loading branch information
stevenbal authored Feb 9, 2024
2 parents fefb1f5 + a771daf commit 4ae1a96
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ django-extensions
sphinx
sphinx_rtd_theme

# performance testing
# performance testing / profiling
locust
django-silk
14 changes: 13 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ attrs==21.2.0
# -r requirements/ci.txt
# glom
# jsonschema
autopep8==1.5.7
# via django-silk
babel==2.9.1
# via sphinx
bandit==1.7.4
Expand Down Expand Up @@ -205,6 +207,7 @@ django==3.2.23
# django-rosetta
# django-sekizai
# django-sendfile2
# django-silk
# django-simple-certmanager
# django-sniplates
# django-timeline-logger
Expand Down Expand Up @@ -414,6 +417,8 @@ django-sessionprofile==1.0
# -c requirements/ci.txt
# -r requirements/ci.txt
# django-digid-eherkenning
django-silk==5.1.0
# via -r requirements/dev.in
django-simple-certmanager==1.4.1
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -610,6 +615,8 @@ glom==20.11.0
# -c requirements/ci.txt
# -r requirements/ci.txt
# mozilla-django-oidc-db
gprof2dot==2022.7.29
# via django-silk
greenlet==3.0.3
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -826,7 +833,9 @@ psycopg2==2.9.9
# -c requirements/ci.txt
# -r requirements/ci.txt
pycodestyle==2.7.0
# via flake8
# via
# autopep8
# flake8
pycparser==2.20
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -1021,6 +1030,7 @@ sqlparse==0.4.4
# -r requirements/ci.txt
# django
# django-debug-toolbar
# django-silk
stevedore==3.5.0
# via bandit
svglib==1.5.1
Expand Down Expand Up @@ -1050,6 +1060,8 @@ tinycss2==1.1.1
# cssselect2
# svglib
# weasyprint
toml==0.10.2
# via autopep8
tomli==1.2.1
# via pep517
tomlkit==0.12.3
Expand Down
6 changes: 6 additions & 0 deletions src/open_inwoner/conf/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@
# playwright multi browser
PLAYWRIGHT_MULTI_ONLY_DEFAULT = True

if config("PROFILE", default=False):
INSTALLED_APPS += ["silk"]
MIDDLEWARE = ["silk.middleware.SilkyMiddleware"] + MIDDLEWARE
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_BINARY = True

# Override settings with local settings.
try:
from .local import * # noqa
Expand Down
3 changes: 3 additions & 0 deletions src/open_inwoner/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@
urlpatterns = [
path("__debug__/", include(debug_toolbar.urls)),
] + urlpatterns

if apps.is_installed("silk"):
urlpatterns.insert(0, path(r"silk/", include("silk.urls", namespace="silk")))

0 comments on commit 4ae1a96

Please sign in to comment.