Metadata-Version: 2.4
Name: django-sphinx-docs
Version: 0.4.1
Summary: Serve Sphinx docs from Django.
Project-URL: Homepage, https://github.com/adamghill/django-sphinx-docs
Author-email: Evgeny Demchenko <little_pea@list.ru>, Adam Hill <github@adamghill.com>
License: BSD
License-File: AUTHORS
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.10
Requires-Dist: django>=3.2
Description-Content-Type: text/markdown

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