diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 45dd496a1c7e6c36f4e3598505d6c54871c252e1..cf42ea71b82511108bd3a8aba692da4f3e5f0357 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,6 +24,9 @@ Removed ~~~~~~~ * Support for materialize-based frontend views (deprecated in 2.11) +* Django debug toolbar + * It caused major performance issues and is not useful with the new + frontend anymore `2.11`_ - 2022-08-27 -------------------- diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index 43dab10b3bae17b6558d0048d93252c656ffa132..60f93440760af81bf2f2c5bd46613e366cb52ff5 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -56,29 +56,6 @@ SECRET_KEY = _settings.get("secret_key", "DoNotUseInProduction") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = _settings.get("maintenance.debug", False) INTERNAL_IPS = _settings.get("maintenance.internal_ips", []) -DEBUG_TOOLBAR_CONFIG = { - "RENDER_PANELS": True, - "SHOW_COLLAPSED": True, - "JQUERY_URL": "", - "SHOW_TOOLBAR_CALLBACK": "aleksis.core.util.core_helpers.dt_show_toolbar", - "DISABLE_PANELS": {}, -} - -DEBUG_TOOLBAR_PANELS = [ - "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.cache.CachePanel", - "debug_toolbar.panels.staticfiles.StaticFilesPanel", - "debug_toolbar.panels.templates.TemplatesPanel", - "debug_toolbar.panels.signals.SignalsPanel", - "debug_toolbar.panels.logging.LoggingPanel", - "debug_toolbar.panels.profiling.ProfilingPanel", - "django_uwsgi.panels.UwsgiPanel", -] UWSGI = { "module": "aleksis.core.wsgi", @@ -124,7 +101,6 @@ INSTALLED_APPS = [ "menu_generator", "reversion", "phonenumber_field", - "debug_toolbar", "django_prometheus", "django_select2", "templated_email", @@ -178,7 +154,6 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", - "debug_toolbar.middleware.DebugToolbarMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.http.ConditionalGetMiddleware", "django.contrib.sites.middleware.CurrentSiteMiddleware", @@ -282,7 +257,6 @@ else: } INSTALLED_APPS.append("cachalot") -DEBUG_TOOLBAR_PANELS.append("cachalot.panels.CachalotPanel") CACHALOT_TIMEOUT = _settings.get("caching.cachalot.timeout", None) CACHALOT_DATABASES = set(["default", "default_oot"]) SILENCED_SYSTEM_CHECKS += ["cachalot.W001"] diff --git a/aleksis/core/urls.py b/aleksis/core/urls.py index 726d8f06581171c7670e54d59fc088ea21e5bfe7..b23b6f1d98a5b54322a6fec86b67d4bf21b900eb 100644 --- a/aleksis/core/urls.py +++ b/aleksis/core/urls.py @@ -7,7 +7,6 @@ from django.views.decorators.csrf import csrf_exempt from django.views.i18n import JavaScriptCatalog import calendarweek.django -import debug_toolbar from ckeditor_uploader import views as ckeditor_uploader_views from django_js_reverse.views import urls_js from health_check.urls import urlpatterns as health_urls @@ -335,10 +334,6 @@ if hasattr(settings, "TWILIO_ACCOUNT_SID"): urlpatterns += [path("", include(tf_twilio_urls))] -# Serve javascript-common if in development -if settings.DEBUG: - urlpatterns.append(path("__debug__/", include(debug_toolbar.urls))) - # Automatically mount URLs from all installed AlekSIS apps for app_config in apps.app_configs.values(): if not app_config.name.startswith("aleksis.apps."): diff --git a/aleksis/core/util/core_helpers.py b/aleksis/core/util/core_helpers.py index 45a2253613b74d97a59c7b7711ae8c5ab31af444..178c8b25c2ca3a26792a879dae63b7ff2ce446dc 100644 --- a/aleksis/core/util/core_helpers.py +++ b/aleksis/core/util/core_helpers.py @@ -41,25 +41,6 @@ def copyright_years(years: Sequence[int], separator: str = ", ", joiner: str = " return separator.join(years_strs) -def dt_show_toolbar(request: HttpRequest) -> bool: - """Add a helper to determine if Django debug toolbar should be displayed. - - Extends the default behaviour by enabling DJDT for superusers independent - of source IP. - """ - from debug_toolbar.middleware import show_toolbar # noqa - - if not settings.DEBUG: - return False - - if show_toolbar(request): - return True - elif hasattr(request, "user") and request.user.is_superuser: - return True - - return False - - def get_app_packages(only_official: bool = False) -> Sequence[str]: """Find all registered apps from the setuptools entrypoint.""" apps = [] diff --git a/pyproject.toml b/pyproject.toml index 021d852b28a226bd4dbb43044709cc4afc457feb..e2fa977c4d003f759496386588a6d99840747e4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,6 @@ secondary = true python = "^3.9" Django = "^3.2.5" django-any-js = "^1.1" -django-debug-toolbar = "^3.2" django-menu-generator-ng = "^1.2.3" django-tables2 = "^2.1" django-phonenumber-field = {version = "^6.1", extras = ["phonenumbers"]}