Skip to main content

Reusable Django app that serves an mkdocs-built site from the same Django project the app is installed in, behind a configurable access gate.

Project description

mkview

CI PyPI License Python Django

Reusable Django app that serves an mkdocs-built site from the same Django project the app is installed in, behind a configurable access gate.

Usage

# settings.py
INSTALLED_APPS = [
    ...,
    "mkview",
]

# urls.py
urlpatterns = [
    ...,
    path("docs/", include("mkview.urls")),
]

Build the docs with mkdocs build and the site is served at /docs/.

Settings

All optional:

  • MKVIEW_ACCESS_CALLBACK — callable (or dotted path to one) taking the request and returning a bool, same pattern as django-debug-toolbar's SHOW_TOOLBAR_CALLBACK. Default: superusers (request.user.is_superuser). Anonymous users are redirected to LOGIN_URL; authenticated users failing the gate get a 403. Any extra conditions (e.g. is_active) are the callback's responsibility.

    # e.g. open the docs up to staff users
    MKVIEW_ACCESS_CALLBACK = lambda request: request.user.is_staff
    
  • MKVIEW_SITE_DIR — path to the mkdocs build output. Default: the site_dir read from BASE_DIR/mkdocs.yml (mkdocs' own default: site). Reading mkdocs.yml requires PyYAML.

The site dir must stay out of STATIC_ROOT — anything there is served publicly, bypassing the access callback.

Tests

From a project with the app installed:

python manage.py test mkview

Or standalone, from this repo (what CI runs):

python -m django test mkview --settings=test_settings

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

mkview-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

mkview-0.1.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mkview-0.1.1.tar.gz.

File metadata

  • Download URL: mkview-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkview-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2d78d00edac0d0aa5073164350f394cbdd3c9d011e4c9f1a29bd25dfe0083f86
MD5 df386acdd0a2719f99228f850ab172b9
BLAKE2b-256 7a8f50f6e9d1bf205e318ca94748c87a98ac872e01f6a73293b56a193f90e5c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkview-0.1.1.tar.gz:

Publisher: release.yml on anibalpacheco/mkview

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

File details

Details for the file mkview-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mkview-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkview-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6dffebaadeb798b4eca96c1cf3296f5257426dc7dc61ad9a75b89451ffe123b6
MD5 bea89ff146b8b04e84253b357ea23b01
BLAKE2b-256 818c7903a190888f9623d497f297c7bb08b02d4b96a4c2bdcfbf5fa33521452f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkview-0.1.1-py3-none-any.whl:

Publisher: release.yml on anibalpacheco/mkview

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