semvec/pypi-packages huggingface dataset:
django-sphinx-docs 0.4.1
Serve Sphinx docs from Django.
License: BSD
Requires Python: >=3.10

# django-sphinx-docs

[![pypi](https://img.shields.io/pypi/v/django-sphinx-docs.svg?style=flat-square)](https://pypi.python.org/pypi/django-sphinx-docs/)
[![license](https://img.shields.io/badge/license-New%20BSD-blue.svg?style=flat-square)](https://raw.githubusercontent.com/littlepea/django-docs/master/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:

    ```bash
    pip install django-sphinx-docs
    ```

2. Add `django_sphinx_docs` to `INSTALLED_APPS` in `settings.py`:

    ```python
    INSTALLED_APPS = (
        ...
        'django_sphinx_docs',
        ...
    )
    ```

3. Add `django_sphinx_docs.urls` to `urls.py`:

    ```python
    urlpatterns = [
        ...
        path('docs/', include('django_sphinx_docs.urls')),
        ...
    ]
    ```

4. Customize configuration:

    ```python
    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

```bash
uv run pytest
```

## Running the example project

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