Skip to main content

Generate clean API Markdown documentation natively from Django URLs and DRF serializers.

Project description

django-api-readme

A production-ready Python package that natively integrates with Django and Django REST Framework (DRF) to automatically discover and map your API routes into clean, structured Markdown documentation.

It reads your configuration dynamically and supports optional payload inspection for DRF serializers without any hard dependencies.

Installation

There are two ways to install this package depending on your environment:

1. Standard Installation

pip install django-api-readme

Use this if you are either NOT using Django REST Framework (DRF), OR if you already have DRF installed in your active project. (If DRF is already present, our package securely detects it at runtime and beautifully documents your endpoints automatically!)

2. Installation alongside DRF

pip install django-api-readme[drf]

Use this strictly as a shortcut if you are building an API inside a completely blank space and want pip to automatically download and install djangorestframework for you seamlessly alongside this package.

Usage

1. Register the Application
Add django_api_readme to your INSTALLED_APPS inside settings.py:

INSTALLED_APPS = [
    # ...
    'django_api_readme',
]

2. Insert the Markers
Add the following template boundaries into your target Markdown file (e.g., README.md). The generator will safely inject the documentation directly between them!

<!-- API_DOCS_START -->
<!-- API_DOCS_END -->

3. Run the Generator
Execute the native management command from your terminal to scan your codebase and overwrite the marker bounds automatically:

python manage.py generate_api_docs --output README.md --include /api/

Command Breakdown:

  • generate_api_docs: Invokes the custom Django management command bundled with this package.
  • --output README.md: (Optional) Specifies the target Markdown file where the API documentation bounds will be injected. Defaults to README.md.
  • --include /api/: (Optional) Filters the discovered URLs so that only endpoints starting with /api/ are documented. This gracefully ignores admin panels or frontend routing!

Example Output

This is a live example of the clean formatting the management command injects structurally:

GET, POST /api/v1/students/

List all enrolled students or create a newly enrolled student.

  • View: StudentViewSet | Name: student-list

Request Schema

Field Type Required Description
first_name string Yes Given name.
email string (email) Yes School email suffix required.
gpa float No (Read-only) Automatically calculated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_api_readme-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_api_readme-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file django_api_readme-0.1.0.tar.gz.

File metadata

  • Download URL: django_api_readme-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for django_api_readme-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b3a634f3deade32a25e9995f3a6bb7474c6f0f6b5e4d703a74089f1d53c4bac
MD5 96c897c577865d0dfb83c59f6f4be9d4
BLAKE2b-256 3b4bb51e2c3756d9e95aa85b030ebec9b89a803fe82c486a7749bf45164fc363

See more details on using hashes here.

File details

Details for the file django_api_readme-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_api_readme-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ad8a91fb87438bb40ef93e0e3b17ec00977db97ee6c20b6aa00c1762e5ae5f1
MD5 2fe031bc1bd8bfba6398045dfd001ac0
BLAKE2b-256 54026adbac5b5f219f09994ce0eac38f71a74d97ca7256a8452e32fa32e8e04e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page