When building the url_name in the swagger and redoc views, reverse uses the current request in the context. If we run our project locally, that would be localhost in the app container but localhost:port_number for the instance outside the app container:
{'url_name': reverse(self.url_name, request=request)},
To reproduce, install drf-spectacular v0.9.7 or above and go to your project's doc page on localhost e.g. localhost:8030/mydocs/redoc/. The following error will show up (notice the missing port number in the request):
Error downloading http://localhost/docs/schema/ Failed to fetch
Stack trace
Error: Error downloading http://localhost/docs/schema/
Failed to fetch
at https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js:63:6628
at https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js:122:36080
TypeError: Failed to fetch
ReDoc Version: 2.0.0-rc.30
Commit: 5bace30
When using v0.9.6 the normal response is rendered successfully.
When building the
url_namein the swagger and redoc views,reverseuses the current request in the context. If we run our project locally, that would belocalhostin the app container butlocalhost:port_numberfor the instance outside the app container:{'url_name': reverse(self.url_name, request=request)},To reproduce, install drf-spectacular v0.9.7 or above and go to your project's doc page on localhost e.g.
localhost:8030/mydocs/redoc/. The following error will show up (notice the missing port number in the request):When using v0.9.6 the normal response is rendered successfully.