Skip to main content

django-templatepages

django-templatepages is a Django app for mapping URLs to templates on the filesystem as if they were static web pages. This is useful for integrating static content into your Django project while still leveraging the Django templating language.

templatepages differs from django.contrib.flatpages in that the content is stored entirely in templates on the filesystem, rather than in a database. We developed this app to address a real-world situation where much of the content in a project is static and managed on the filesystem under version control. templatepages allows us to factor out the page layout using the Django templating language, and cleanly integrate the static content with other dynamic components implemented as Django apps.

Python’s mimetypes.guess_type() is used to determine appropriate Content-type and Content-encoding headers for the HTTP response. This means that you can use templatepages for more than just HTML files; for example, we use it to serve dynamically-generated CSS stylesheets.

Usage

Using templatepages is relatively straightforward: just add it to INSTALLED_APPS in your project’s settings.py file, and integrate the URL mapping in your project’s urls.py file. Then place your templates in your project’s templates/templatepages folder.

For example, the following stanza in urls.py will configure your project to map all requests beginning with articles/ to templatepages:

urlpatterns = patterns('',
    (r'^articles/', include('templatepages.urls')),
)

In this example, a request for http://your.site/articles/contact.html should result in templatepages attempting to return a rendered template based on templates/templatepages/contact.html. If this file cannot be found, templatepages will raise Http404.

If no filename is specified in the URL, templatepages will attempt to render index.html.

templatepages passes RequestContext to the template, so full access to template context processor variables is available.

Metadata

Release files for django-templatepages 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-templatepages 0.2.3
File Size Uploaded Provenance
django-templatepages-0.2.3.tar.gz 4.4 kB Without provenance Details

Release files / django-templatepages-0.2.3.tar.gz

Download URL django-templatepages-0.2.3.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
133030c4cc736dec688144cca6254ef46e2e7e8f7d69cfab02fe835eefc3c8f5
BLAKE2b-256 checksum
How to use checksums
fb4e7d10b0145d9f4cfac73df64ab1fc8ec065ce10525e84bed81dc4c9fd890e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-templatepages 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page