Have this error while trying to autogenerate API docs for django rest framework in django 2.2.4, from what I'm seeing in the logs it has something to do with the deprectation of the {% load staticfiles %}
templateSyntaxError at /
'staticfiles' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
countries
i18n
l10n
log
phone
rest_framework
static
tz
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 3.0
Exception Type: TemplateSyntaxError
Exception Value:
'staticfiles' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
countries
i18n
l10n
log
phone
rest_framework
static
tz
{% load i18n %}
2 {% load staticfiles %}
3 <!DOCTYPE html>
4 <html lang="en">
5 <head>
6 <meta charset="UTF-8">
7 <title>Swagger UI</title>
8 <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
9 <link href="{% static 'rest_framework_swagger/bundles/vendors.bundle.css' %}" rel="stylesheet" type="text/css">
10 <link href="{% static 'rest_framework_swagger/bundles/app.bundle.css' %}" rel="stylesheet" type="text/css">
11 {% block extra_styles %}
12 {# -- Add any additional CSS scripts here -- #}
My urls file, it has the same format that in the django_rest_swagger documentation:
from django.contrib import admin
from django.urls import path, include
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='My API')
urlpatterns = [
path('admin/', admin.site.urls),
path('api/user/', include('user.urls'),
path('', schema_view)]
https://github.com/axnsan12/drf-yasg#quickstart
In settings.py: