Skip to main content

Serve Sphinx docs from Django.

Project description

django-sphinx-docs

pypi license

django-sphinx-docs allows to serve Sphinx generated docs directly from Django.

This is a fork of https://github.com/littlepea/django-docs to support Django 4.0+.

Dependencies

  • Python 3.10+
  • Django 3.2+

Installation

  1. Install django-sphinx-docs package:

    pip install django-sphinx-docs
    
  2. Add django_sphinx_docs to INSTALLED_APPS in settings.py:

    INSTALLED_APPS = (
        ...
        'django_sphinx_docs',
        ...
    )
    
  3. Add django_sphinx_docs.urls to urls.py:

    urlpatterns = [
        ...
        path('docs/', include('django_sphinx_docs.urls')),
        ...
    ]
    
  4. Customize configuration:

    DOCS_ROOT = os.path.join(PROJECT_PATH, '../docs/_build/html')
    DOCS_ACCESS = 'staff'
    

Configuration

DOCS_ROOT (required)

Absolute path to the root directory of html docs generated by Sphinx (just like STATIC_ROOT / MEDIA_ROOT settings).

DOCS_ACCESS (optional)

Docs access level (public by default). Possible values:

  • public - (default) docs are visible to everyone
  • login_required - docs are visible only to authenticated users
  • staff - docs are visible only to staff users (user.is_staff == True)
  • superuser - docs are visible only to superusers (user.is_superuser == True)

Running the tests

uv run pytest

Running the example project

cd example
uv run python manage.py migrate
uv run python manage.py runserver

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_sphinx_docs-0.4.1.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

django_sphinx_docs-0.4.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file django_sphinx_docs-0.4.1.tar.gz.

File metadata

  • Download URL: django_sphinx_docs-0.4.1.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_sphinx_docs-0.4.1.tar.gz
Algorithm Hash digest
SHA256 eb220566ae371f958bae4cf7913371084ce03e97e3f4be31250cd53bfe55e073
MD5 c149eff6f7fe9d011e384fdd4fbbd4cc
BLAKE2b-256 44d61ac32ff61affc826e59f5309056cef808ee5668ddd4eb2bf334befb3ff5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sphinx_docs-0.4.1.tar.gz:

Publisher: publish.yml on adamghill/django-sphinx-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_sphinx_docs-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sphinx_docs-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a39e7e7b92633fcad585745d4a05d4037c76025ee9eaf66b05f26f7664e846b
MD5 4d22601c6de63753e452c2da1788b832
BLAKE2b-256 4454fd85c5f50d6320f8bf7ac9755e8c4a409b105b148552f4adfc5f3aad0ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sphinx_docs-0.4.1-py3-none-any.whl:

Publisher: publish.yml on adamghill/django-sphinx-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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