Add Silk middleware and related settings for performance monitoring
- Introduced SILK_ENABLED setting to toggle Silk middleware. - Updated ALLOWED_HOSTS to include "testserver" when not in DEBUG mode. - Modified urlpatterns to conditionally include Silk URLs. - Added django-silk dependency to pyproject.toml. - Enhanced feed queries to optimize performance and reduce N+1 issues. - Updated tests to verify query limits for various feeds.
This commit is contained in:
parent
2f9c5a9328
commit
e968f5cdea
9 changed files with 289 additions and 57 deletions
|
|
@ -11,10 +11,13 @@ if TYPE_CHECKING:
|
|||
from django.urls.resolvers import URLPattern
|
||||
from django.urls.resolvers import URLResolver
|
||||
|
||||
urlpatterns: list[URLResolver] | list[URLPattern | URLResolver] = [ # type: ignore[assignment]
|
||||
urlpatterns: [URLPattern | URLResolver] = [ # type: ignore[assignment]
|
||||
path(route="", view=include("twitch.urls", namespace="twitch")),
|
||||
]
|
||||
|
||||
if getattr(settings, "ENABLE_SILK", False):
|
||||
urlpatterns += [path("silk/", include("silk.urls", namespace="silk"))]
|
||||
|
||||
# Serve media in development
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue