Skip to content

Commit

Permalink
Add changes for logging API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed Jul 27, 2023
1 parent 9aee88e commit 61c3484
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ black = "*"
factory_boy = "*"
rich = "*"
sphinx = "*"
furo = "*"
sphinx-autobuild = "*"
sphinxcontrib-mermaid = "*"
docutils = "==0.19"
sphinxcontrib-mermaid = "*""
myst-parser = "*"
ansible-lint = "*"

Expand Down Expand Up @@ -96,4 +94,4 @@ django-convenient-formsets = "~=1.2.1"
django-basicauth = "*"
django-file-resubmit = "*"
django-guardian = "*"
docutils = "==0.19"
drf-api-logger = "*"
4 changes: 4 additions & 0 deletions apps/accounts/admin_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,7 @@ def get_app_list(self, request):


greenweb_admin = GreenWebAdmin(name="greenweb_admin")
from drf_api_logger.models import APILogsModel
from drf_api_logger.admin import APILogsAdmin

greenweb_admin.register(APILogsModel, APILogsAdmin)
Empty file.
9 changes: 9 additions & 0 deletions greenweb/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
"widget_tweaks",
# analysis
"explorer",
# tracking inbound API usage
'drf_api_logger',
# project specific
"apps.theme",
"apps.accounts",
Expand Down Expand Up @@ -139,10 +141,17 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
'drf_api_logger.middleware.api_logger_middleware.APILoggerMiddleware',
# see the section below on BASICAUTH
"basicauth.middleware.BasicAuthMiddleware",
]

DRF_API_LOGGER_DATABASE = True # Default to False
legacy_api_views = ["legacy-greencheck-image", "legacy-greencheck-multi", "legacy-directory-detail"]
high_volume_views = ["green-domain-detail"]
debugger_api_views = ["djdt:history_sidebar"]
DRF_API_LOGGER_SKIP_URL_NAME = [ *legacy_api_views, *debugger_api_views, *high_volume_views]

# set up django-guardian as authentcation backend
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend", # this is a default value
Expand Down

0 comments on commit 61c3484

Please sign in to comment.