Skip to content

Commit

Permalink
add silk profiler (#1437)
Browse files Browse the repository at this point in the history
Co-authored-by: Vignesh Hari <[email protected]>
  • Loading branch information
sainak and vigneshhari authored Jul 9, 2023
1 parent 5b9b57f commit 77a79a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa F405

# django-silk
# ------------------------------------------------------------------------------
# https://github.com/jazzband/django-silk#requirements
INSTALLED_APPS += ["silk"] # noqa F405
MIDDLEWARE += ["silk.middleware.SilkyMiddleware"] # noqa F405
# https://github.com/jazzband/django-silk#profiling
SILKY_PYTHON_PROFILER = True

# django-debug-toolbar
# ------------------------------------------------------------------------------
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#prerequisites
Expand Down
5 changes: 3 additions & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@
path("500/", default_views.server_error),
]
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns += [path("__debug__/", include("debug_toolbar.urls"))]

urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns
if "silk" in settings.INSTALLED_APPS:
urlpatterns += [path("silk/", include("silk.urls", namespace="silk"))]

if settings.DEBUG or not settings.IS_PRODUCTION:
urlpatterns += [
Expand Down
1 change: 1 addition & 0 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Werkzeug==2.3.6 # https://werkzeug.palletsprojects.com/en/latest/changes/
# ------------------------------------------------------------------------------
django-debug-toolbar==4.1 # https://github.com/jazzband/django-debug-toolbar/releases
django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions/blob/main/CHANGELOG.md
django-silk==5.0.3 # https://github.com/jazzband/django-silk/blob/master/CHANGELOG.md

# Code quality
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 77a79a3

Please sign in to comment.