Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#937 | django-silk profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Dec 9, 2023
1 parent c974bc6 commit 087f8c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,3 +522,10 @@
OIDC_STORE_ACCESS_TOKEN = True
OIDC_CREATE_USER = True
OIDC_CALLBACK_CLASS = 'core.users.views.OCLOIDCAuthenticationCallbackView'

# Profiler Django Silk
if ENV == 'development':
INSTALLED_APPS = [*INSTALLED_APPS, 'silk']
MIDDLEWARE = [*MIDDLEWARE, "silk.middleware.SilkyMiddleware"]
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_RESULT_PATH = '/code/core/'
8 changes: 8 additions & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
SmartChecksumView, ConceptDuplicateDeleteView
from core.concepts.views import ConceptsHierarchyAmendAdminView
from core.importers.views import BulkImportView
from core.settings import ENV

SchemaView = get_schema_view(
openapi.Info(
Expand Down Expand Up @@ -96,5 +97,12 @@
ConceptDuplicateDeleteView.as_view(), name='concepts-duplicate-versions-delete'),
]

if ENV == 'development':
urlpatterns = [
path("silk/", include("silk.urls", namespace="silk")),
*urlpatterns
]


handler500 = 'rest_framework.exceptions.server_error'
handler400 = 'rest_framework.exceptions.bad_request'
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ django-dirtyfields==1.9.2
jsonpath-ng==1.5.3
mozilla-django-oidc==3.0.0
django-celery-beat==2.5.0
jsondiff==2.0.0
jsondiff==2.0.0
django-silk==5.0.4

0 comments on commit 087f8c5

Please sign in to comment.