Skip to main content

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.

Project description

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

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-statictemplate-2.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

django_statictemplate-2.0.1-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-statictemplate-2.0.1.tar.gz.

File metadata

File hashes

Hashes for django-statictemplate-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e2bd87d3f29063e423ba3c6c79897ee271ad2f0a49439707a5c9b9c1cc282454
MD5 52a141069d2e84782c573c8cd413cbcb
BLAKE2b-256 fea8affa576b50a84466d1c387fe6e7ddd552bdb6aeca18e945edbf620e5006e

See more details on using hashes here.

File details

Details for the file django_statictemplate-2.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_statictemplate-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9c2534c909896c35a11d83732eb10b856cd45ee3bfc9d721120fcafd4f17164e
MD5 ff00076715ebe0f8b1875c0c93c6f65e
BLAKE2b-256 6ba8e87a69180588529fb742e08fba9df72d4529401bc897cdc1a5be919479ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page