Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
Adds debug toolbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
emorozov committed Dec 1, 2020
1 parent 3c2ac59 commit 137dcbc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions parrot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

if DEBUG:
INSTALLED_APPS.append('debug_toolbar')
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')

ROOT_URLCONF = 'parrot.urls'

TEMPLATES = [
Expand Down Expand Up @@ -109,3 +113,5 @@
'Stubs': 'fas fa-feather-alt',
'Logs': 'fas fa-layer-group',
}

INTERNAL_IPS = env.list('PARROT_INTERNAL_HOSTS', default=['127.0.0.1'])
6 changes: 5 additions & 1 deletion parrot/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import re

import debug_toolbar
from django.conf import settings
from django.contrib import admin
from django.shortcuts import redirect
from django.urls import path, re_path
from django.urls import include, path, re_path
from django.views import static

from http_stubs import views
Expand All @@ -25,3 +26,6 @@
urlpatterns += [
path('<path:path>', views.HTTPStubView.as_view()),
]

if settings.DEBUG:
urlpatterns.insert(0, path('__debug__/', include(debug_toolbar.urls)))
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ uvicorn = "~0.12.2"
psycopg2 = "~2.8.6"
django-environ = "^0.4.5"
django-extensions = "^3.1.0"
django-debug-toolbar = "^3.1.1"

[tool.poetry.dev-dependencies]
pytest = "~6.1"
Expand Down

0 comments on commit 137dcbc

Please sign in to comment.