You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

routing.py 626B

123456789101112131415161718
  1. from channels.routing import ProtocolTypeRouter, URLRouter
  2. from django.urls import re_path
  3. from channels.routing import URLRouter
  4. from channels.http import AsgiHandler
  5. from channels.auth import AuthMiddlewareStack
  6. import django_eventstream
  7. urlpatterns = [
  8. #idz lt. URL ein Eventstream auszuliefern
  9. re_path(r'^events/',
  10. AuthMiddlewareStack(URLRouter(django_eventstream.routing.urlpatterns)),
  11. {'channels': ['notice']}),
  12. #bei allen anderen Anfragen werden die Standart-Router verwendet
  13. re_path(r'', AsgiHandler),
  14. ]
  15. application = ProtocolTypeRouter({
  16. 'http': URLRouter(urlpatterns)
  17. })