[Fixed]-Django_rest_swagger โ€“ 'staticfiles' is not a registered tag library. Must be one of:


The problem is that staticfiles template tag was deprecated in Django 2.2 and is finally removed in Django 3.0

The djagno-rest-swagger package itself is deprecated and is no longer maintained.

Their GitHub repo recommends something like drf-yasg


The library is deprecated

Quick fix(at your own risk): go to site-packages/rest_framework_swagger/templates/rest_framework_swagger/index.html

The line with {% load staticfiles %} (line 2) should be {% load static %}. You can edit it manually

๐Ÿ‘คkayondo terry


You can also create a staticfiles.py in the templatetags folder of your app and then paste this code:

from django import template
from django.templatetags.static import (do_static as _do_static,static as _static,)

register = template.Library()

def static(path):
    return _static(path)

def do_static(parser, token):
    return _do_static(parser, token)'

into the file.

But make sure that the your app comes before rest_framework_swagger in the app list of your settings.py.



The staticfiles template is deprecated in Django 2.2 and removed in Django 3.

We need to override the rest_framework_swagger/index.html.

Go to site-packages/rest_framework_swagger/templates/rest_framework_swagger

Copy the rest_framework_swagger folder and paste it in your own templates folder

Then replace the line 2 with {% load static %} in index.html

Hope it works !!

๐Ÿ‘คMuthu Kumar


I found out that the django-rest-swagger Module is not available in django 3.0 or more since the template static label is removed.

Please use other swagger packages, such as drf-yasg



To get around this:

  • navigate to your installation path of rest_framework_swagger, for me itโ€™s env\Lib\site-packages\rest_framework_swagger
  • goto templates/rest_framework_swagger folder and change staticfile to static in your index.html

This is because {% load staticfiles %} and {% load admin_static %} were deprecated in Django 2.1, and removed in Django 3.0.

This work around solution is what you can use till we get it updated in rest_framework_swagger app.



The django-rest-framework is using the Template Tag staticfiles which was used in Django 2. It was been dropped in Django 3.0, while the django-rest-frame repo is not while update. It was deprecated in 2019. I whould suggest using drf-yasg from

It preforms a similar function, to provide API docs automatically using swapper. Iโ€™ve used it and it seems good enough.

๐Ÿ‘คahsan mukhtar



In settings.py:

   'django.contrib.staticfiles',  # required for serving swagger ui's css/js files

Leave a comment