Skip to content

Commit

Permalink
feat: adding debug toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
yokwejuste committed Aug 18, 2024
1 parent 2791a59 commit 5e22ede
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions config/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
beautifulsoup4==4.12.3
boto3==1.35.0
cfgv==3.4.0
celery==5.4.0
django-cors-headers==4.3.1
django-crequest==2018.5.11
django-debug-toolbar==4.4.6
django-dotenv==1.4.2
django-extensions==3.2.3
django-filter==23.5
Expand All @@ -18,7 +18,6 @@ nodeenv==1.8.0
pillow==10.3.0
psycopg2-binary==2.9.9
python-dotenv==1.0.0
redis==5.0.8
tzdata==2023.4
virtualenv==20.25.0
whitenoise==6.7.0
2 changes: 2 additions & 0 deletions website_api/routes/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import debug_toolbar
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
Expand All @@ -10,6 +11,7 @@
urlpatterns = (
[
path("admin/", admin.site.urls),
path('__debug__/', include(debug_toolbar.urls)),
path(f"{BASE_API_URL}/", include("apps.users.routes.api")),
path(f"{BASE_API_URL}/", include("apps.events.routes.api")),
path(f"{BASE_API_URL}/", include("apps.events.routes.extra")),
Expand Down
13 changes: 12 additions & 1 deletion website_api/settings/extra.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from utils.main import load_documentation
from .base import BASE_DIR, TIME_ZONE
from .base import BASE_DIR, TIME_ZONE, INSTALLED_APPS, MIDDLEWARE

REST_FRAMEWORK = {
"EXCEPTION_HANDLER": "exceptions.rest_exception.rest_exception_handler",
Expand Down Expand Up @@ -106,3 +106,14 @@
CELERY_RESULT_BACKEND = os.getenv('CELERY_RESULT_BACKEND')
CELERY_TIMEZONE = TIME_ZONE
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True

# Django Debug ToolBar settings
if os.getenv("ENVIRONMENT") == "development":
INSTALLED_APPS += ['debug_toolbar']
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware']
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': lambda request: True,
}
INTERNAL_IPS = [
'127.0.0.1',
]

0 comments on commit 5e22ede

Please sign in to comment.