We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug] Websockets do not respect subpath
### Discussed in https://github.com/paperless-ngx/paperless-ngx/discussions/2236

<div type='discussions-op-text'>

<sup>Originally posted by **davidgiga1993** December 21, 2022</sup>
I migrated from paprless-ng to paperless-ngx and the websocket connection isn't working anymore:
```
WebSocket connection to 'wss://home.dev-core.org/paperless/ws/status/' failed:
```
The server returns status code 500.

I'm using `/paperless` as path and configured it according to the [documentation](https://docs.paperless-ngx.com/configuration/#hosting-and-security)
```
PAPERLESS_FORCE_SCRIPT_NAME=/paperless
PAPERLESS_STATIC_URL=/paperless/static/
PAPERLESS_MEDIA_URL=/paperless/media/

PAPERLESS_URL=https://my-domain.com
```

my nginx config hasn't changed since and worked fine before:
```
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;

client_body_buffer_size 128k;
proxy_next_upstream error timeout;
proxy_redirect  http://  $scheme://;
proxy_http_version 1.1;
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;
proxy_buffers 64 256k;

# Allow websockets
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

real_ip_header X-Forwarded-For;
real_ip_recursive on;

send_timeout 5m;
proxy_read_timeout 360;
proxy_send_timeout 360;
proxy_connect_timeout 360;
```

It looks like paperless ngx isn't using the context path for the websockets - here is a test using curl. The first request (with the correct path) returns `500`, the second one without any context path returns correctly `403`
```
nas paperless # curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: my-domain.com" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" localhost:8000/paperless/ws/status/
HTTP/1.1 500 Internal Server Error
content-type: text/plain; charset=utf-8
content-length: 21
connection: close

Internal Server Error#
nas paperless # curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: my-domain.com" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" localhost:8000/ws/status/
HTTP/1.1 403 Forbidden
Date: Sun, 11 Dec 2022 10:03:35 GMT
Server: Python/3.9 websockets/10.4
Content-Length: 0
Content-Type: text/plain
Connection: close
```

any ideas? Anything else I should test?
    </div>

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/paperless/urls.py`
Content:
```
1 from django.conf import settings
2 from django.conf.urls import include
3 from django.contrib import admin
4 from django.contrib.auth.decorators import login_required
5 from django.urls import path
6 from django.urls import re_path
7 from django.utils.translation import gettext_lazy as _
8 from django.views.decorators.csrf import csrf_exempt
9 from django.views.generic import RedirectView
10 from documents.views import AcknowledgeTasksView
11 from documents.views import BulkDownloadView
12 from documents.views import BulkEditView
13 from documents.views import CorrespondentViewSet
14 from documents.views import DocumentTypeViewSet
15 from documents.views import IndexView
16 from documents.views import LogViewSet
17 from documents.views import PostDocumentView
18 from documents.views import RemoteVersionView
19 from documents.views import SavedViewViewSet
20 from documents.views import SearchAutoCompleteView
21 from documents.views import SelectionDataView
22 from documents.views import StatisticsView
23 from documents.views import StoragePathViewSet
24 from documents.views import TagViewSet
25 from documents.views import TasksViewSet
26 from documents.views import UiSettingsView
27 from documents.views import UnifiedSearchViewSet
28 from paperless.consumers import StatusConsumer
29 from paperless.views import FaviconView
30 from paperless_mail.views import MailAccountViewSet
31 from paperless_mail.views import MailRuleViewSet
32 from rest_framework.authtoken import views
33 from rest_framework.routers import DefaultRouter
34 
35 api_router = DefaultRouter()
36 api_router.register(r"correspondents", CorrespondentViewSet)
37 api_router.register(r"document_types", DocumentTypeViewSet)
38 api_router.register(r"documents", UnifiedSearchViewSet)
39 api_router.register(r"logs", LogViewSet, basename="logs")
40 api_router.register(r"tags", TagViewSet)
41 api_router.register(r"saved_views", SavedViewViewSet)
42 api_router.register(r"storage_paths", StoragePathViewSet)
43 api_router.register(r"tasks", TasksViewSet, basename="tasks")
44 api_router.register(r"mail_accounts", MailAccountViewSet)
45 api_router.register(r"mail_rules", MailRuleViewSet)
46 
47 
48 urlpatterns = [
49     re_path(
50         r"^api/",
51         include(
52             [
53                 re_path(
54                     r"^auth/",
55                     include(
56                         ("rest_framework.urls", "rest_framework"),
57                         namespace="rest_framework",
58                     ),
59                 ),
60                 re_path(
61                     r"^search/autocomplete/",
62                     SearchAutoCompleteView.as_view(),
63                     name="autocomplete",
64                 ),
65                 re_path(r"^statistics/", StatisticsView.as_view(), name="statistics"),
66                 re_path(
67                     r"^documents/post_document/",
68                     PostDocumentView.as_view(),
69                     name="post_document",
70                 ),
71                 re_path(
72                     r"^documents/bulk_edit/",
73                     BulkEditView.as_view(),
74                     name="bulk_edit",
75                 ),
76                 re_path(
77                     r"^documents/selection_data/",
78                     SelectionDataView.as_view(),
79                     name="selection_data",
80                 ),
81                 re_path(
82                     r"^documents/bulk_download/",
83                     BulkDownloadView.as_view(),
84                     name="bulk_download",
85                 ),
86                 re_path(
87                     r"^remote_version/",
88                     RemoteVersionView.as_view(),
89                     name="remoteversion",
90                 ),
91                 re_path(
92                     r"^ui_settings/",
93                     UiSettingsView.as_view(),
94                     name="ui_settings",
95                 ),
96                 re_path(
97                     r"^acknowledge_tasks/",
98                     AcknowledgeTasksView.as_view(),
99                     name="acknowledge_tasks",
100                 ),
101                 path("token/", views.obtain_auth_token),
102             ]
103             + api_router.urls,
104         ),
105     ),
106     re_path(r"^favicon.ico$", FaviconView.as_view(), name="favicon"),
107     re_path(r"admin/", admin.site.urls),
108     re_path(
109         r"^fetch/",
110         include(
111             [
112                 re_path(
113                     r"^doc/(?P<pk>\d+)$",
114                     RedirectView.as_view(
115                         url=settings.BASE_URL + "api/documents/%(pk)s/download/",
116                     ),
117                 ),
118                 re_path(
119                     r"^thumb/(?P<pk>\d+)$",
120                     RedirectView.as_view(
121                         url=settings.BASE_URL + "api/documents/%(pk)s/thumb/",
122                     ),
123                 ),
124                 re_path(
125                     r"^preview/(?P<pk>\d+)$",
126                     RedirectView.as_view(
127                         url=settings.BASE_URL + "api/documents/%(pk)s/preview/",
128                     ),
129                 ),
130             ],
131         ),
132     ),
133     re_path(
134         r"^push$",
135         csrf_exempt(
136             RedirectView.as_view(
137                 url=settings.BASE_URL + "api/documents/post_document/",
138             ),
139         ),
140     ),
141     # Frontend assets TODO: this is pretty bad, but it works.
142     path(
143         "assets/<path:path>",
144         RedirectView.as_view(
145             url=settings.STATIC_URL + "frontend/en-US/assets/%(path)s",
146         ),
147     ),
148     # TODO: with localization, this is even worse! :/
149     # login, logout
150     path("accounts/", include("django.contrib.auth.urls")),
151     # Root of the Frontent
152     re_path(r".*", login_required(IndexView.as_view()), name="base"),
153 ]
154 
155 
156 websocket_urlpatterns = [
157     re_path(r"ws/status/$", StatusConsumer.as_asgi()),
158 ]
159 
160 # Text in each page's <h1> (and above login form).
161 admin.site.site_header = "Paperless-ngx"
162 # Text at the end of each page's <title>.
163 admin.site.site_title = "Paperless-ngx"
164 # Text at the top of the admin index page.
165 admin.site.index_title = _("Paperless-ngx administration")
166
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/paperless/urls.py b/src/paperless/urls.py
--- a/src/paperless/urls.py
+++ b/src/paperless/urls.py
@@ -154,7 +154,7 @@
 
 
 websocket_urlpatterns = [
-    re_path(r"ws/status/$", StatusConsumer.as_asgi()),
+    path(settings.BASE_URL.lstrip("/") + "ws/status/", StatusConsumer.as_asgi()),
 ]
 
 # Text in each page's <h1> (and above login form).

{"golden_diff": "diff --git a/src/paperless/urls.py b/src/paperless/urls.py\n--- a/src/paperless/urls.py\n+++ b/src/paperless/urls.py\n@@ -154,7 +154,7 @@\n \n \n websocket_urlpatterns = [\n-    re_path(r\"ws/status/$\", StatusConsumer.as_asgi()),\n+    path(settings.BASE_URL.lstrip(\"/\") + \"ws/status/\", StatusConsumer.as_asgi()),\n ]\n \n # Text in each page's <h1> (and above login form).\n", "issue": "[Bug] Websockets do not respect subpath\n### Discussed in https://github.com/paperless-ngx/paperless-ngx/discussions/2236\r\n\r\n<div type='discussions-op-text'>\r\n\r\n<sup>Originally posted by **davidgiga1993** December 21, 2022</sup>\r\nI migrated from paprless-ng to paperless-ngx and the websocket connection isn't working anymore:\r\n```\r\nWebSocket connection to 'wss://home.dev-core.org/paperless/ws/status/' failed:\r\n```\r\nThe server returns status code 500.\r\n\r\nI'm using `/paperless` as path and configured it according to the [documentation](https://docs.paperless-ngx.com/configuration/#hosting-and-security)\r\n```\r\nPAPERLESS_FORCE_SCRIPT_NAME=/paperless\r\nPAPERLESS_STATIC_URL=/paperless/static/\r\nPAPERLESS_MEDIA_URL=/paperless/media/\r\n\r\nPAPERLESS_URL=https://my-domain.com\r\n```\r\n\r\nmy nginx config hasn't changed since and worked fine before:\r\n```\r\nproxy_set_header Host $host;\r\nproxy_set_header X-Forwarded-Proto $scheme;\r\nproxy_set_header X-Forwarded-Host $http_host;\r\nproxy_set_header X-Forwarded-Uri $request_uri;\r\nproxy_set_header X-Forwarded-Ssl on;\r\nproxy_set_header X-Forwarded-For $remote_addr;\r\nproxy_set_header X-Real-IP $remote_addr;\r\n\r\nclient_body_buffer_size 128k;\r\nproxy_next_upstream error timeout;\r\nproxy_redirect  http://  $scheme://;\r\nproxy_http_version 1.1;\r\nproxy_cache_bypass $cookie_session;\r\nproxy_no_cache $cookie_session;\r\nproxy_buffers 64 256k;\r\n\r\n# Allow websockets\r\nproxy_cache_bypass $http_upgrade;\r\nproxy_set_header Upgrade $http_upgrade;\r\nproxy_set_header Connection \"upgrade\";\r\n\r\nreal_ip_header X-Forwarded-For;\r\nreal_ip_recursive on;\r\n\r\nsend_timeout 5m;\r\nproxy_read_timeout 360;\r\nproxy_send_timeout 360;\r\nproxy_connect_timeout 360;\r\n```\r\n\r\nIt looks like paperless ngx isn't using the context path for the websockets - here is a test using curl. The first request (with the correct path) returns `500`, the second one without any context path returns correctly `403`\r\n```\r\nnas paperless # curl -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: my-domain.com\" -H \"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\" -H \"Sec-WebSocket-Version: 13\" localhost:8000/paperless/ws/status/\r\nHTTP/1.1 500 Internal Server Error\r\ncontent-type: text/plain; charset=utf-8\r\ncontent-length: 21\r\nconnection: close\r\n\r\nInternal Server Error#\r\nnas paperless # curl -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: my-domain.com\" -H \"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\" -H \"Sec-WebSocket-Version: 13\" localhost:8000/ws/status/\r\nHTTP/1.1 403 Forbidden\r\nDate: Sun, 11 Dec 2022 10:03:35 GMT\r\nServer: Python/3.9 websockets/10.4\r\nContent-Length: 0\r\nContent-Type: text/plain\r\nConnection: close\r\n```\r\n\r\nany ideas? Anything else I should test?\r\n    </div>\n", "before_files": [{"content": "from django.conf import settings\nfrom django.conf.urls import include\nfrom django.contrib import admin\nfrom django.contrib.auth.decorators import login_required\nfrom django.urls import path\nfrom django.urls import re_path\nfrom django.utils.translation import gettext_lazy as _\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.generic import RedirectView\nfrom documents.views import AcknowledgeTasksView\nfrom documents.views import BulkDownloadView\nfrom documents.views import BulkEditView\nfrom documents.views import CorrespondentViewSet\nfrom documents.views import DocumentTypeViewSet\nfrom documents.views import IndexView\nfrom documents.views import LogViewSet\nfrom documents.views import PostDocumentView\nfrom documents.views import RemoteVersionView\nfrom documents.views import SavedViewViewSet\nfrom documents.views import SearchAutoCompleteView\nfrom documents.views import SelectionDataView\nfrom documents.views import StatisticsView\nfrom documents.views import StoragePathViewSet\nfrom documents.views import TagViewSet\nfrom documents.views import TasksViewSet\nfrom documents.views import UiSettingsView\nfrom documents.views import UnifiedSearchViewSet\nfrom paperless.consumers import StatusConsumer\nfrom paperless.views import FaviconView\nfrom paperless_mail.views import MailAccountViewSet\nfrom paperless_mail.views import MailRuleViewSet\nfrom rest_framework.authtoken import views\nfrom rest_framework.routers import DefaultRouter\n\napi_router = DefaultRouter()\napi_router.register(r\"correspondents\", CorrespondentViewSet)\napi_router.register(r\"document_types\", DocumentTypeViewSet)\napi_router.register(r\"documents\", UnifiedSearchViewSet)\napi_router.register(r\"logs\", LogViewSet, basename=\"logs\")\napi_router.register(r\"tags\", TagViewSet)\napi_router.register(r\"saved_views\", SavedViewViewSet)\napi_router.register(r\"storage_paths\", StoragePathViewSet)\napi_router.register(r\"tasks\", TasksViewSet, basename=\"tasks\")\napi_router.register(r\"mail_accounts\", MailAccountViewSet)\napi_router.register(r\"mail_rules\", MailRuleViewSet)\n\n\nurlpatterns = [\n    re_path(\n        r\"^api/\",\n        include(\n            [\n                re_path(\n                    r\"^auth/\",\n                    include(\n                        (\"rest_framework.urls\", \"rest_framework\"),\n                        namespace=\"rest_framework\",\n                    ),\n                ),\n                re_path(\n                    r\"^search/autocomplete/\",\n                    SearchAutoCompleteView.as_view(),\n                    name=\"autocomplete\",\n                ),\n                re_path(r\"^statistics/\", StatisticsView.as_view(), name=\"statistics\"),\n                re_path(\n                    r\"^documents/post_document/\",\n                    PostDocumentView.as_view(),\n                    name=\"post_document\",\n                ),\n                re_path(\n                    r\"^documents/bulk_edit/\",\n                    BulkEditView.as_view(),\n                    name=\"bulk_edit\",\n                ),\n                re_path(\n                    r\"^documents/selection_data/\",\n                    SelectionDataView.as_view(),\n                    name=\"selection_data\",\n                ),\n                re_path(\n                    r\"^documents/bulk_download/\",\n                    BulkDownloadView.as_view(),\n                    name=\"bulk_download\",\n                ),\n                re_path(\n                    r\"^remote_version/\",\n                    RemoteVersionView.as_view(),\n                    name=\"remoteversion\",\n                ),\n                re_path(\n                    r\"^ui_settings/\",\n                    UiSettingsView.as_view(),\n                    name=\"ui_settings\",\n                ),\n                re_path(\n                    r\"^acknowledge_tasks/\",\n                    AcknowledgeTasksView.as_view(),\n                    name=\"acknowledge_tasks\",\n                ),\n                path(\"token/\", views.obtain_auth_token),\n            ]\n            + api_router.urls,\n        ),\n    ),\n    re_path(r\"^favicon.ico$\", FaviconView.as_view(), name=\"favicon\"),\n    re_path(r\"admin/\", admin.site.urls),\n    re_path(\n        r\"^fetch/\",\n        include(\n            [\n                re_path(\n                    r\"^doc/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/download/\",\n                    ),\n                ),\n                re_path(\n                    r\"^thumb/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/thumb/\",\n                    ),\n                ),\n                re_path(\n                    r\"^preview/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/preview/\",\n                    ),\n                ),\n            ],\n        ),\n    ),\n    re_path(\n        r\"^push$\",\n        csrf_exempt(\n            RedirectView.as_view(\n                url=settings.BASE_URL + \"api/documents/post_document/\",\n            ),\n        ),\n    ),\n    # Frontend assets TODO: this is pretty bad, but it works.\n    path(\n        \"assets/<path:path>\",\n        RedirectView.as_view(\n            url=settings.STATIC_URL + \"frontend/en-US/assets/%(path)s\",\n        ),\n    ),\n    # TODO: with localization, this is even worse! :/\n    # login, logout\n    path(\"accounts/\", include(\"django.contrib.auth.urls\")),\n    # Root of the Frontent\n    re_path(r\".*\", login_required(IndexView.as_view()), name=\"base\"),\n]\n\n\nwebsocket_urlpatterns = [\n    re_path(r\"ws/status/$\", StatusConsumer.as_asgi()),\n]\n\n# Text in each page's <h1> (and above login form).\nadmin.site.site_header = \"Paperless-ngx\"\n# Text at the end of each page's <title>.\nadmin.site.site_title = \"Paperless-ngx\"\n# Text at the top of the admin index page.\nadmin.site.index_title = _(\"Paperless-ngx administration\")\n", "path": "src/paperless/urls.py"}], "after_files": [{"content": "from django.conf import settings\nfrom django.conf.urls import include\nfrom django.contrib import admin\nfrom django.contrib.auth.decorators import login_required\nfrom django.urls import path\nfrom django.urls import re_path\nfrom django.utils.translation import gettext_lazy as _\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.generic import RedirectView\nfrom documents.views import AcknowledgeTasksView\nfrom documents.views import BulkDownloadView\nfrom documents.views import BulkEditView\nfrom documents.views import CorrespondentViewSet\nfrom documents.views import DocumentTypeViewSet\nfrom documents.views import IndexView\nfrom documents.views import LogViewSet\nfrom documents.views import PostDocumentView\nfrom documents.views import RemoteVersionView\nfrom documents.views import SavedViewViewSet\nfrom documents.views import SearchAutoCompleteView\nfrom documents.views import SelectionDataView\nfrom documents.views import StatisticsView\nfrom documents.views import StoragePathViewSet\nfrom documents.views import TagViewSet\nfrom documents.views import TasksViewSet\nfrom documents.views import UiSettingsView\nfrom documents.views import UnifiedSearchViewSet\nfrom paperless.consumers import StatusConsumer\nfrom paperless.views import FaviconView\nfrom paperless_mail.views import MailAccountViewSet\nfrom paperless_mail.views import MailRuleViewSet\nfrom rest_framework.authtoken import views\nfrom rest_framework.routers import DefaultRouter\n\napi_router = DefaultRouter()\napi_router.register(r\"correspondents\", CorrespondentViewSet)\napi_router.register(r\"document_types\", DocumentTypeViewSet)\napi_router.register(r\"documents\", UnifiedSearchViewSet)\napi_router.register(r\"logs\", LogViewSet, basename=\"logs\")\napi_router.register(r\"tags\", TagViewSet)\napi_router.register(r\"saved_views\", SavedViewViewSet)\napi_router.register(r\"storage_paths\", StoragePathViewSet)\napi_router.register(r\"tasks\", TasksViewSet, basename=\"tasks\")\napi_router.register(r\"mail_accounts\", MailAccountViewSet)\napi_router.register(r\"mail_rules\", MailRuleViewSet)\n\n\nurlpatterns = [\n    re_path(\n        r\"^api/\",\n        include(\n            [\n                re_path(\n                    r\"^auth/\",\n                    include(\n                        (\"rest_framework.urls\", \"rest_framework\"),\n                        namespace=\"rest_framework\",\n                    ),\n                ),\n                re_path(\n                    r\"^search/autocomplete/\",\n                    SearchAutoCompleteView.as_view(),\n                    name=\"autocomplete\",\n                ),\n                re_path(r\"^statistics/\", StatisticsView.as_view(), name=\"statistics\"),\n                re_path(\n                    r\"^documents/post_document/\",\n                    PostDocumentView.as_view(),\n                    name=\"post_document\",\n                ),\n                re_path(\n                    r\"^documents/bulk_edit/\",\n                    BulkEditView.as_view(),\n                    name=\"bulk_edit\",\n                ),\n                re_path(\n                    r\"^documents/selection_data/\",\n                    SelectionDataView.as_view(),\n                    name=\"selection_data\",\n                ),\n                re_path(\n                    r\"^documents/bulk_download/\",\n                    BulkDownloadView.as_view(),\n                    name=\"bulk_download\",\n                ),\n                re_path(\n                    r\"^remote_version/\",\n                    RemoteVersionView.as_view(),\n                    name=\"remoteversion\",\n                ),\n                re_path(\n                    r\"^ui_settings/\",\n                    UiSettingsView.as_view(),\n                    name=\"ui_settings\",\n                ),\n                re_path(\n                    r\"^acknowledge_tasks/\",\n                    AcknowledgeTasksView.as_view(),\n                    name=\"acknowledge_tasks\",\n                ),\n                path(\"token/\", views.obtain_auth_token),\n            ]\n            + api_router.urls,\n        ),\n    ),\n    re_path(r\"^favicon.ico$\", FaviconView.as_view(), name=\"favicon\"),\n    re_path(r\"admin/\", admin.site.urls),\n    re_path(\n        r\"^fetch/\",\n        include(\n            [\n                re_path(\n                    r\"^doc/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/download/\",\n                    ),\n                ),\n                re_path(\n                    r\"^thumb/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/thumb/\",\n                    ),\n                ),\n                re_path(\n                    r\"^preview/(?P<pk>\\d+)$\",\n                    RedirectView.as_view(\n                        url=settings.BASE_URL + \"api/documents/%(pk)s/preview/\",\n                    ),\n                ),\n            ],\n        ),\n    ),\n    re_path(\n        r\"^push$\",\n        csrf_exempt(\n            RedirectView.as_view(\n                url=settings.BASE_URL + \"api/documents/post_document/\",\n            ),\n        ),\n    ),\n    # Frontend assets TODO: this is pretty bad, but it works.\n    path(\n        \"assets/<path:path>\",\n        RedirectView.as_view(\n            url=settings.STATIC_URL + \"frontend/en-US/assets/%(path)s\",\n        ),\n    ),\n    # TODO: with localization, this is even worse! :/\n    # login, logout\n    path(\"accounts/\", include(\"django.contrib.auth.urls\")),\n    # Root of the Frontent\n    re_path(r\".*\", login_required(IndexView.as_view()), name=\"base\"),\n]\n\n\nwebsocket_urlpatterns = [\n    path(settings.BASE_URL.lstrip(\"/\") + \"ws/status/\", StatusConsumer.as_asgi()),\n]\n\n# Text in each page's <h1> (and above login form).\nadmin.site.site_header = \"Paperless-ngx\"\n# Text at the end of each page's <title>.\nadmin.site.site_title = \"Paperless-ngx\"\n# Text at the top of the admin index page.\nadmin.site.index_title = _(\"Paperless-ngx administration\")\n", "path": "src/paperless/urls.py"}]}