Skip to main content

Django Statictemplate

Latest Version Travis status Coveralls status Download Wheel Status License

This project aims at providing a compromise between dynamic error pages for Django (that use template tags etc and therefore potentially error too) and having to write static error pages by hand.

It does so by providing a management command that can be invoked to turn a dynamic Django template into a static HTML page with no template tags whatsoever in it.

Note that this means that every time you change your error pages, you need to re-run this script. Ideally this is part of your deploy process.

Installation

pip install django-statictemplate inside your virtualenv.

Add statictemplate to your INSTALLED_APPS.

Configuration

django-statictemplate does not require any configuration. by default.

By default django-statictemplate overrides the configured middlewares for enhanced compatibility and to avoid incompatibilities.

However this may not be always feasible: if you need a specific set of middlewares to be loaded set:

STATICTEMPLATE_OVERRIDE_MIDDLEWARE = False

in you settings files.

Please note that django-statictemplate has not been tested with every possible middleware, thus you may encounter failures and strange behaviors especially fi you use middlewares that changes the response type.

Usage

python manage.py statictemplate dynamic_500.html > 500.html

or

python manage.py statictemplate dynamic_500.html -f 500.html

The management command renders a template given by name (standard Django template name resolution applies) and writes the output to stdout or to a file.

Arguments

  • template: standard django template name to render

  • language: sets the client django_language cookie to render page in the given language

  • extra_request: extra parameters injected in the request. Parameters must be serialized in querystring format (e.g.: 'variable=value&variable=value'; please note the single quote to protect ampersand &).

Options

  • -f, --file: file destionation for command output

License

This project is licensed under the BSD license.

Contributors

See https://github.com/ojii/django-statictemplate/contributors

Release files for django-statictemplate 2.0.1

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-statictemplate 2.0.1
File Size Uploaded
django-statictemplate-2.0.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-statictemplate 2.0.1
File Interpreter ABI Platform
django_statictemplate-2.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.2 kB

Release files / django-statictemplate-2.0.1.tar.gz

Download URL django-statictemplate-2.0.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e2bd87d3f29063e423ba3c6c79897ee271ad2f0a49439707a5c9b9c1cc282454
BLAKE2b-256 checksum
How to use checksums
fea8affa576b50a84466d1c387fe6e7ddd552bdb6aeca18e945edbf620e5006e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_statictemplate-2.0.1-py2.py3-none-any.whl

Download URL django_statictemplate-2.0.1-py2.py3-none-any.whl
Size 5.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9c2534c909896c35a11d83732eb10b856cd45ee3bfc9d721120fcafd4f17164e
BLAKE2b-256 checksum
How to use checksums
6ba8e87a69180588529fb742e08fba9df72d4529401bc897cdc1a5be919479ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0

2 release files

1.1

1 release file

1.0

1 release file

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