-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will only be active if installed - either manually or through `requirements_dev.txt`.
- Loading branch information
Showing
7 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
django-debug-toolbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.conf import settings | ||
from django.urls import include, path | ||
|
||
|
||
def debug_toolbar_urls(): | ||
if not settings.USE_DEBUG_TOOLBAR: | ||
return [] | ||
return [ | ||
path("__debug__/", include('debug_toolbar.urls')), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import copy | ||
import logging | ||
import sys | ||
from importlib.util import find_spec | ||
from pathlib import Path | ||
|
||
import django.views.static | ||
|
@@ -32,6 +33,7 @@ | |
SECRET_KEY = ' ' | ||
DEBUG = True | ||
ALLOWED_HOSTS = ['*'] | ||
INTERNAL_IPS = ['127.0.0.1'] | ||
MEDIA_ROOT = BASE_DIR.parent / 'media' | ||
MEDIA_URL = '/media/' | ||
SOCIAL_AUTH_DATAPORTEN_KEY = '' | ||
|
@@ -56,6 +58,9 @@ | |
# be changed in production | ||
PARENT_HOST = "makentnu.localhost:8000" | ||
|
||
# Is `True` if `django-debug-toolbar` is installed | ||
USE_DEBUG_TOOLBAR = find_spec('debug_toolbar') is not None # (custom setting) | ||
|
||
EVENT_TICKET_EMAIL = "[email protected]" # (custom setting) | ||
EMAIL_SITE_URL = "https://makentnu.no" # (custom setting) | ||
|
||
|
@@ -111,6 +116,8 @@ | |
# See this page for a list of all management commands: https://django-extensions.readthedocs.io/en/latest/command_extensions.html | ||
'django_extensions', | ||
|
||
*(['debug_toolbar'] if USE_DEBUG_TOOLBAR else []), | ||
|
||
# Should be placed last, | ||
# "to ensure that exceptions inside other apps' signal handlers do not affect the integrity of file deletions within transactions" | ||
'django_cleanup.apps.CleanupConfig', | ||
|
@@ -121,6 +128,8 @@ | |
# Must be the first entry (see https://django-hosts.readthedocs.io/en/latest/#installation) | ||
'django_hosts.middleware.HostsRequestMiddleware', | ||
|
||
*(['debug_toolbar.middleware.DebugToolbarMiddleware'] if USE_DEBUG_TOOLBAR else []), | ||
|
||
# (See hints for ordering at https://docs.djangoproject.com/en/stable/ref/middleware/#middleware-ordering) | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
|
@@ -355,6 +364,28 @@ def static_lazy(path): | |
SIMPLE_HISTORY_FILEFIELD_TO_CHARFIELD = True | ||
|
||
|
||
if USE_DEBUG_TOOLBAR: | ||
DEBUG_TOOLBAR_CONFIG = { | ||
'RENDER_PANELS': False, | ||
'DISABLE_PANELS': { | ||
# 'debug_toolbar.panels.history.HistoryPanel', | ||
'debug_toolbar.panels.versions.VersionsPanel', | ||
# 'debug_toolbar.panels.timer.TimerPanel', | ||
# 'debug_toolbar.panels.settings.SettingsPanel', | ||
# 'debug_toolbar.panels.headers.HeadersPanel', | ||
# 'debug_toolbar.panels.request.RequestPanel', | ||
'debug_toolbar.panels.sql.SQLPanel', | ||
'debug_toolbar.panels.staticfiles.StaticFilesPanel', | ||
'debug_toolbar.panels.templates.TemplatesPanel', | ||
'debug_toolbar.panels.cache.CachePanel', | ||
'debug_toolbar.panels.signals.SignalsPanel', | ||
# 'debug_toolbar.panels.logging.LoggingPanel', | ||
'debug_toolbar.panels.redirects.RedirectsPanel', | ||
'debug_toolbar.panels.profiling.ProfilingPanel', | ||
}, | ||
} | ||
|
||
|
||
# See https://docs.djangoproject.com/en/stable/topics/logging/ for | ||
# more details on how to customize your logging configuration. | ||
LOGGING = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters