A reusable Django app providing a structured documentation system (Library > Shelf > Book > Chapter > Page) served on a dedicated URL path (or optionally a subdomain), rendering content from .md files within each Django app.
Project description
django-site-documentation
A reusable Django application that provides a structured documentation system served on a dedicated URL path (or optionally a subdomain). Content is rendered from .md files located within each Django app's directory.
Security Requirements
When deploying this application in production, the following settings must be configured:
SESSION_COOKIE_SECURE = True— ensures session cookie is only sent over HTTPS.CSRF_COOKIE_SECURE = True— ensures CSRF cookie is only sent over HTTPS.SESSION_COOKIE_HTTPONLY = True— prevents JavaScript access to the session cookie.SECURE_HSTS_SECONDS = 31536000— enables HTTP Strict Transport Security (start with a lower value during rollout).SECURE_SSL_REDIRECT = True— redirects all HTTP traffic to HTTPS.SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')— required when behind a reverse proxy.
Additionally, add django_site_documentation.middleware.ContentSecurityPolicyMiddleware to your MIDDLEWARE list (after SecurityMiddleware) to enable Content Security Policy headers:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
...
'django_site_documentation.middleware.ContentSecurityPolicyMiddleware',
]
Concepts
- Library: The entire documentation site
- Shelf: A Django app that contains documentation
- Chapter: A folder inside
django-doc/ - Page: A
.mdfile inside a chapter folder
Quick Start
-
Install the package:
pip install django-site-documentation
-
Add to
INSTALLED_APPS:INSTALLED_APPS = [ ... 'django_site_documentation', ]
-
Configure the documentation URL in
settings.py:DOCUMENTATION_DOMAIN = 'localhost:8000/doc'
-
Add the middleware after
SessionMiddlewareandAuthenticationMiddleware:MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ... 'django_site_documentation.middleware.DocumentationDomainMiddleware', ]
-
Login directly on the documentation URL — the app includes its own login/logout views at
localhost:8000/doc/login/. Just make sure your user is a superuser to access edit features. -
Add the documentation URL to
ALLOWED_HOSTSandCSRF_TRUSTED_ORIGINS(no subdomains needed):ALLOWED_HOSTS = [ 'example.com', 'localhost', # local development ] CSRF_TRUSTED_ORIGINS = [ 'https://example.com', 'http://localhost:8000', # dev ]
-
Create documentation in any installed app:
yourapp/ └── django-doc/ ├── getting-started/ │ ├── index.md │ └── installation.md └── guides/ └── advanced-usage.md
Frontmatter
Each .md file can include YAML frontmatter for metadata:
---
title: My Page Title
order: 1
---
Chapters can use an index.md file to set chapter-level metadata.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_site_documentation-1.0.0.tar.gz.
File metadata
- Download URL: django_site_documentation-1.0.0.tar.gz
- Upload date:
- Size: 138.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
091687308dff53b4802c530c86f31898e4dec8eade5bfb302f090e56639d098b
|
|
| MD5 |
8519c54117fa936f119250485ea1ca96
|
|
| BLAKE2b-256 |
cdfa88b8d66ab708ccea943830d70acdf3a262d0dabbf3338436c98ad1ce03fe
|
File details
Details for the file django_site_documentation-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_site_documentation-1.0.0-py3-none-any.whl
- Upload date:
- Size: 146.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
544db34933bf2ffd5ad439db09b7da6672ee7fef6c111c215afb309c937b757c
|
|
| MD5 |
8b3bd66ebc17e45a738bc331f7ea4a6b
|
|
| BLAKE2b-256 |
472416f85677c40af1b4a39b630e07bc23603811b5282961d2b922407e673f69
|