mirror of
https://github.com/tanrax/django-interactive-frameworks-benchmark
synced 2026-01-08 06:13:36 +01:00
- Add Django Reactor (v5.3.0b0) as fifth framework in comparison - Rename HTMX to django-htmx throughout for clarity - Update plots: change "Network Requests" to "HTTP Requests" - Regenerate all performance plots with 5 frameworks - Update navigation across all templates to include Reactor - Add Reactor component (XAlertList) and WebSocket configuration Performance results (5 frameworks): - LiveView: 9.35ms (WebSocket) - Reactor: 12.00ms (WebSocket) - django-htmx: 16.48ms (AJAX) - Unicorn: 26.76ms (AJAX) - SSR: 47.25ms (Full reload)
25 lines
830 B
Python
25 lines
830 B
Python
import os
|
|
|
|
import django
|
|
from channels.auth import AuthMiddlewareStack
|
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
|
from django.core.asgi import get_asgi_application
|
|
from django.urls import path
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
|
django.setup()
|
|
|
|
# Import handlers to ensure they are registered (must be after django.setup())
|
|
import alerts.liveview_components.alerts # noqa: E402, F401
|
|
from liveview.consumers import LiveViewConsumer # noqa: E402
|
|
from reactor.urls import websocket_urlpatterns as reactor_ws_patterns # noqa: E402
|
|
|
|
application = ProtocolTypeRouter({
|
|
"http": get_asgi_application(),
|
|
"websocket": AuthMiddlewareStack(
|
|
URLRouter([
|
|
path('ws/liveview/<str:room_name>/', LiveViewConsumer.as_asgi()),
|
|
] + reactor_ws_patterns)
|
|
),
|
|
})
|