Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show debug toolbar always #406

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ara/settings/dev/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import socket
from datetime import datetime, timezone

from ara.settings import INSTALLED_APPS, LOGGING, MIDDLEWARE
Expand All @@ -12,7 +13,7 @@
"http://localhost",
]

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_ALL_ORIGINS = True

SSO_IS_BETA = False

Expand All @@ -29,6 +30,18 @@
"debug_toolbar_force.middleware.ForceDebugToolbarMiddleware",
]

# https://django-debug-toolbar.readthedocs.io/

_, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips] + [
"127.0.0.1",
"10.0.2.2",
]

DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda _: True,
}

REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"] = (
"rest_framework.authentication.BasicAuthentication",
"ara.authentication.CsrfExemptSessionAuthentication",
Expand Down
7 changes: 0 additions & 7 deletions ara/settings/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,8 @@

STATIC_URL = "/static/"


# https://django-debug-toolbar.readthedocs.io/

INTERNAL_IPS = ("127.0.0.1",)

if env("DJANGO_ENV") == "development":
INTERNAL_IPS = type(str("c"), (), {"__contains__": lambda *a: True})()


SESSION_ENGINE = "django.contrib.sessions.backends.db"
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = True
Expand Down
4 changes: 4 additions & 0 deletions ara/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@

CELERY_TASK_ALWAYS_EAGER = True
ELASTICSEARCH_INDEX_NAME = "articles_test"

DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda _: False,
}
5 changes: 1 addition & 4 deletions ara/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
),
]

# installed apps (test environment)
if settings.DEBUG:
import debug_toolbar

urlpatterns += [
path("__debug__/", include(debug_toolbar.urls)),
path("api/__debug__/", include("debug_toolbar.urls")),
]
Loading