File: routing.py

package info (click to toggle)
celery-progress 0.1.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 156 kB
  • sloc: python: 272; javascript: 168; makefile: 6
file content (12 lines) | stat: -rw-r--r-- 429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
from django.conf.urls import url

from celery_progress.websockets import consumers

try:
    progress_consumer = consumers.ProgressConsumer.as_asgi()  # New in Channels 3, works similar to Django's .as_view()
except AttributeError:
    progress_consumer = consumers.ProgressConsumer  # Channels 3 not installed, revert to Channels 2 behavior

urlpatterns = [
    url(r'^ws/progress/(?P<task_id>[\w-]+)/?$', progress_consumer),
]