add django-silk to the docker dev setup

This commit is contained in:
sadnub 2022-04-06 15:53:09 -04:00
parent 90644a21a3
commit 27e93e499f
4 changed files with 42 additions and 1 deletions

View File

@ -60,6 +60,8 @@ DEBUG = True
DOCKER_BUILD = True DOCKER_BUILD = True
SWAGGER_ENABLED = True
CERT_FILE = '${CERT_PUB_PATH}' CERT_FILE = '${CERT_PUB_PATH}'
KEY_FILE = '${CERT_PRIV_PATH}' KEY_FILE = '${CERT_PRIV_PATH}'
@ -88,6 +90,12 @@ MESH_TOKEN_KEY = '${MESH_TOKEN}'
REDIS_HOST = '${REDIS_HOST}' REDIS_HOST = '${REDIS_HOST}'
MESH_WS_URL = '${MESH_WS_URL}' MESH_WS_URL = '${MESH_WS_URL}'
ADMIN_ENABLED = True ADMIN_ENABLED = True
DEV_MIDDLEWARE = [
"silk.middleware.SilkyMiddleware",
]
DEV_APPS = ["silk"]
EOF EOF
)" )"

View File

@ -34,3 +34,6 @@ Pygments==2.11.2
isort==5.10.1 isort==5.10.1
mypy==0.931 mypy==0.931
types-pytz==2021.3.4 types-pytz==2021.3.4
model-bakery==1.4.0
coverage==6.3.2
django-silk==4.3.0

View File

@ -75,6 +75,9 @@ if "GHACTIONS" in os.environ:
REDIS_HOST = "localhost" REDIS_HOST = "localhost"
ADMIN_ENABLED = False ADMIN_ENABLED = False
DEV_MIDDLEWARE = []
DEV_APPS = []
try: try:
from .local_settings import * from .local_settings import *
except ImportError: except ImportError:
@ -151,6 +154,7 @@ INSTALLED_APPS = [
"scripts", "scripts",
"alerts", "alerts",
"drf_spectacular", "drf_spectacular",
*DEV_APPS,
] ]
@ -178,6 +182,29 @@ if ADMIN_ENABLED: # type: ignore
) )
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware", ##
*DEV_MIDDLEWARE,
"tacticalrmm.middleware.LogIPMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"tacticalrmm.middleware.AuditMiddleware",
"tacticalrmm.middleware.LinuxMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
if ADMIN_ENABLED: # type: ignore
MIDDLEWARE += ("django.contrib.messages.middleware.MessageMiddleware",)
try:
if DEMO: # type: ignore
MIDDLEWARE += ("tacticalrmm.middleware.DemoMiddleware",)
except:
pass
ROOT_URLCONF = "tacticalrmm.urls" ROOT_URLCONF = "tacticalrmm.urls"

View File

@ -58,6 +58,9 @@ if getattr(settings, "SWAGGER_ENABLED", False):
), ),
) )
if "silk" in getattr(settings, "DEV_APPS", []):
urlpatterns += [path("silk/", include("silk.urls", namespace="silk"))]
ws_urlpatterns = [ ws_urlpatterns = [
path("ws/dashinfo/", DashInfo.as_asgi()), path("ws/dashinfo/", DashInfo.as_asgi()), # type: ignore
] ]