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 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.0.tar.gz (4.9 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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkview-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for mkview-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41ff8c61ea53b4ceb306f2fdc78f0c21a66cdcc6df8a9b3a1fea586e170a48da
MD5 a28ec1f68c409276d1accd89c263edd1
BLAKE2b-256 da43228c32737006780689c3de3334d82df880cd1b7e483e4f4afdd5dc38e3ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkview-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for mkview-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc1e9783822b2259f0a8e85a6d1fa89d13668e13c08791eecbf68c1fb02f045
MD5 999c6712c229ec9928a99d81a1317e06
BLAKE2b-256 c4cb58091ee59257a24bd915daa35987cc097429fca5c968ebbeb0f6fae788c4

See more details on using hashes here.

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