Update browsable-api.md

Deprecated url(), use re_path(). Show imports.
This commit is contained in:
rafaelgramoschi 2024-08-21 22:33:54 +02:00 committed by GitHub
parent f113ab6b68
commit 54884a53aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,9 +20,11 @@ By default, the API will return the format specified by the headers, which in th
To quickly add authentication to the browesable api, add a routes named `"login"` and `"logout"` under the namespace `"rest_framework"`. DRF provides default routes for this which you can add to your urlconf:
```python
from django.urls import include, re_path
urlpatterns = [
# ...
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework"))
re_path(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework"))
]
```