Skip to main content

Generate Django pages from Markdown, HTML, and Django template files.

Project description

Django Nanopages

PyPI Documentation Tests Coverage

Generate Django pages from Markdown, HTML, and Django template files.

Integrates well with:

Creating pages

Nanopages supports

  • page.md - markdown
  • page.html - Django template

Where two files have the same name, the markdown file will be used. These would both be served at /page/

HTML files are treated as Django templates, so you can also override blocks.

Files called index are special - they are the default content for their path, eg

  • section/index.md will be served at /section/
  • section/page.md will be served at /section/page/

Source pages can also provide context for your Django templates - see context documentation

Quickstart

Try the example

Try out the example site using nanodjango:

git clone https://github.com/radiac/django-nanopages.git
cd django-nanopages/example
uv run example/website.py

Using with nanodjango

  1. Install nanodjango along with its optional dependencies, including django-nanopages and django-distill:

    pip install nanodjango[full]
    
  2. In your nanodjango script, register your directory of pages at a URL, at the end of your script:

    app.pages(url="", path="pages/")
    
  3. Put your markdown, HTML, or Django template files under the path - in this case, a dir next to your script called "pages".

  4. Optional: build to a static site with django-distill:

    nanodjango manage myscript.py distill-local static_site/
    

    (see django-distill docs for more configuration and deployment options)

Using with full Django

  1. Install:

    pip install django-nanopages
    
  2. Add it to your INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        ...
        "django_nanopages",
    ]
    
  3. In your urls.py, register your directory of pages at a URL:

    from django_nanopages import Pages
    
    urlpatterns = [
        ...
        path("", Pages("pages/")),
    ]
    
  4. Put your markdown, HTML, or Django template files under the path - in this case, a dir called "pages".

  5. Optional: build to a static site with django-distill:

    ./manage.py distill-local static_site/
    

    (see django-distill docs for more configuration and deployment options)

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_nanopages-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

django_nanopages-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file django_nanopages-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for django_nanopages-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9dd5b64be37d28c23574e847cceab938e8faf4bac80cba0f76a3693fa888ec4a
MD5 56269641605d2f4a189ca078cc00040f
BLAKE2b-256 63e693cc30166aae3d9c81afb4bc29575d58550afdea24ba1affd23b985b6984

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_nanopages-0.2.0.tar.gz:

Publisher: pypi.yml on radiac/django-nanopages

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_nanopages-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_nanopages-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b3a3bc1d47fe8097d1f39b7799467116eabd0e4bf5fe96fd81089c20865512f
MD5 9c4d5ed37f71166cdb3e93d26e9f6b89
BLAKE2b-256 61fde8cdd12b9b8589f81d3ecc35df6f3592bffcb57abd05545f67ce88b12b89

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_nanopages-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on radiac/django-nanopages

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