Skip to content

Commit

Permalink
Merge pull request #86 from open-contracting/fix/routes-prefix
Browse files Browse the repository at this point in the history
fix: add support prefix for ws route
  • Loading branch information
VDigitall committed Apr 14, 2021
2 parents aaff1d1 + 0b647bc commit 64ab4a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/routing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.urls import re_path
from rest_framework.routers import DefaultRouter
from rest_framework_nested import routers
Expand Down Expand Up @@ -26,6 +27,7 @@
upload_preview_router = routers.NestedSimpleRouter(upload_table_router, r"tables", lookup="table")
upload_preview_router.register(r"preview", views.TablePreviewViewSet, basename="uploads-selections-preview")

prefix = "/" if not settings.API_PREFIX else settings.API_PREFIX
websocket_urlpatterns = [
re_path(r"ws/api/(?P<upload_id>[0-9a-f-]+)/$", consumers.ValidationConsumer.as_asgi()),
re_path(r"{prefix}ws/(?P<upload_id>[0-9a-f-]+)/$".format(prefix=prefix), consumers.ValidationConsumer.as_asgi()),
]

0 comments on commit 64ab4a9

Please sign in to comment.