
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
drf-api-doc-generator
Advanced tools
Auto-generate production-quality API documentation (PDF, HTML, JSON/OpenAPI) for Django REST Framework with a single command
Auto-generate production-quality API documentation for Django REST Framework with a single command! 🚀
Stop manually writing API documentation! This tool automatically discovers your DRF endpoints, serializers, authentication, and permissions, then generates beautiful documentation in PDF, HTML, or OpenAPI JSON format.
python manage.py generate_api_docspip install drf-api-doc-generator
# settings.py
INSTALLED_APPS = [
# ... your other apps
'rest_framework',
'drf_api_doc_generator', # Add this line
]
# Generate PDF for a specific app
python manage.py generate_api_docs auth
# Generate for multiple apps
python manage.py generate_api_docs auth users products
# Generate all formats (PDF + HTML + JSON)
python manage.py generate_api_docs auth --format all
# Generate for all apps
python manage.py generate_api_docs --all
Documentation will be generated in ./api_docs/ directory:
api_docs_YYYYMMDD_HHMMSS.pdfapi_docs_YYYYMMDD_HHMMSS.htmlapi_docs_YYYYMMDD_HHMMSS.jsonpython manage.py generate_api_docs [OPTIONS] [APPS...]
| Option | Short | Description |
|---|---|---|
--all | Generate docs for all installed apps | |
--format | -f | Output format: pdf, html, json, or all (default: pdf) |
--output | -o | Output directory (default: ./api_docs/) |
--title | Custom documentation title | |
--api-version | API version string | |
--description | API description | |
--open | Open file after generation | |
-v 2 | Verbose output (show all endpoints) |
# Generate PDF with custom title
python manage.py generate_api_docs auth --title "My Awesome API"
# Generate to custom directory
python manage.py generate_api_docs auth --output ./docs/api/
# Generate and open automatically
python manage.py generate_api_docs auth --format html --open
# Verbose mode - show all discovered endpoints
python manage.py generate_api_docs auth -v 2
Add optional configuration to your Django settings:
# settings.py
API_DOCS_CONFIG = {
'TITLE': 'My API Documentation',
'VERSION': '2.0.0',
'DESCRIPTION': 'Complete API reference for developers',
'CONTACT_EMAIL': 'api@example.com',
'LOGO_PATH': 'path/to/logo.png', # Optional logo for PDF cover
'THEME_COLOR': '#2563eb', # Primary theme color
}
The generator automatically extracts:
Professional documentation with:
Interactive documentation with:
Standard specification compatible with:
class UserView(APIView):
"""
User Management Endpoint
Handles user profile operations including retrieval and updates.
"""
def get(self, request):
"""Get the current user's profile"""
pass
class UserSerializer(serializers.ModelSerializer):
email = serializers.EmailField(
help_text="User's email address for notifications"
)
password = serializers.CharField(
write_only=True,
min_length=8,
help_text="Password must be at least 8 characters"
)
class LoginView(APIView):
serializer_class = LoginSerializer # This gets auto-detected
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for Django developers
FAQs
Auto-generate production-quality API documentation (PDF, HTML, JSON/OpenAPI) for Django REST Framework with a single command
We found that drf-api-doc-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.