Install & Compatibility
Where this runs
tested against v2.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 79.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 6.5s · import 0.000s · 80MB
79MB installed
● package 79MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
get_swagger_view
✓ from rest_framework_swagger.views import get_swagger_view
✗ from rest_framework_swagger.views import get_swagger_view
Add 'rest_framework_swagger' to INSTALLED_APPS in settings.py and include the swagger URL pattern in your project's urls.py. The get_swagger_view function creates a view for the Swagger UI.
# settings.py
INSTALLED_APPS = [
# ...
'rest_framework',
'rest_framework_swagger',
]
# urls.py
from django.urls import re_path
from rest_framework_swagger.views import get_swagger_view
# Replace 'My API' with your project's title
schema_view = get_swagger_view(title='My API')
urlpatterns = [
# ... other url patterns
re_path(r'^swagger/$', schema_view)
]
Debug
Known issues
deprecatedThe `django-rest-swagger` library is deprecated and is in maintenance mode, receiving only critical bug fixes. It's built against older DRF versions and Swagger UI v3.13.6, making it unsuitable for modern projects.fixFor new projects or existing projects needing active development/modern features, migrate to `drf-yasg` or `drf-spectacular` which provide OpenAPI 3.0+ support and are actively maintained.
affects: 2.x and earlier
breakingVersion 2.0.0 introduced significant breaking changes, shifting from introspection/YAML overrides to CoreAPI and renderer classes for schema generation, and requiring Django REST Framework 3.4+.fixReview the 2.0.0 release notes for `django-rest-swagger` and update code to use CoreAPI schema generation and renderer classes. Ensure `djangorestframework` is at least 3.4.
affects: Before 2.0.0 to 2.0.0+
breakingVersion 2.1.0 increased the minimum required Django REST Framework version to 3.5.1.fixUpgrade `djangorestframework` to at least 3.5.1 to ensure compatibility with `django-rest-swagger` 2.1.0 and later.
affects: Before 2.1.0 to 2.1.0+
gotchaAuthentication support, especially for non-session APIs (e.g., Token or JWT authentication), might be limited or require custom workarounds due to the older Swagger UI version and bootstrap client architecture.fixConsult the `django-rest-swagger` GitHub issues for community-contributed workarounds or consider migrating to more actively developed alternatives with better, out-of-the-box authentication support.
affects: 2.x
Upgrade
Version history
2.2.0latest on PyPI · released Apr 30, 2018
Audit
Dependencies
djangorestframeworkrequiredRequired for core functionality; minimum version 3.5.1
DjangorequiredRequired for Django projects; minimum version not explicitly stated but compatible with DRF 3.5.1 generally means Django 1.8-2.x.