Skip to main content

Django app that builds `template` and `elements` components from the Government Digital Services style guide

Project description

It should be easy to make a Django-based service that follows Government Digital Services’ style guide and reference materials. But https://pypi.python.org/pypi/govuk-template is not kept updated and is not readily usable in Django and https://github.com/alphagov/govuk_template cannot be installed directly into a Django project without complex build steps.

This package takes components published by GDS and creates an app in a Django project which can then be used as normal. This process downloads a release from https://github.com/alphagov/govuk_template and the contents of Node.js packages https://www.npmjs.com/package/govuk-elements-sass and https://www.npmjs.com/package/govuk_frontend_toolkit

Usage

  • Setup a Django project using manage.py startproject or other means

  • Install django-govuk-template and add govuk_template_base to INSTALLED_APPS

  • Call manage.py startgovukapp [[app name, e.g. govuk_template]]
    • Add this app to INSTALLED_APPS

    • Ensure that this app is included in source control as the intention is that it’s only rebuilt as needed

    • If an update is needed in the future, delete the app created in previous step and run this command again

  • Add govuk_template_base.context_processors.govuk_template_base to the template context processors

  • Use [[app name, e.g. govuk_template]].html as the template to extend from and overrive the inner_content block

See the demo folder in this repository on GitHub, it is not included in distributions.

Additionally, add django-govuk-forms to your project to output Django forms styled using GOV.UK elements. You can install this package automatically by adding django-govuk-template[forms] to your requirements file.

Development

Please report bugs and open pull requests on GitHub.

Use python setup.py test to run all tests.

This repository does not need to be updated for every release of GDS’s packages, only breaking changes for overridden components may need fixes.

If any localisable strings change, run python setup.py makemessages compilemessages.

Distribute a new version to PyPi by updating the VERSION tuple in govuk_template_base and run python setup.py compilemessages sdist bdist_wheel upload.

To do

  • Improve SCSS building mechanism and add print CSS

  • It would be nice to require as few external tools as possible (e.g. docker/node/ruby) to make building simpler

  • Add browser-sync / watchdog components for easier local development using testserver

  • Add additional GOV.UK patterns

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-govuk-template-0.4.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

django_govuk_template-0.4-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file django-govuk-template-0.4.tar.gz.

File metadata

File hashes

Hashes for django-govuk-template-0.4.tar.gz
Algorithm Hash digest
SHA256 7e869d9e3d506a1cfdcbf398037424faa191f63f99075b5aedccb6c82c485a73
MD5 2bc06ff8c6db3e9b3efc3cc55ffcd247
BLAKE2b-256 6a41331b944eab0440397daf9ba781dc2d42934b2922a899ca79f8ee71546f0a

See more details on using hashes here.

File details

Details for the file django_govuk_template-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_govuk_template-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 47e429d4399a97f14037ab1a209854159aef4aed73489dce97f3b2aa2b975dcb
MD5 c3a7f6a772f51f4c4238976c7e25cca1
BLAKE2b-256 aaffc0a2451f7e7a89b574368cc6b92d041d1cf21ebb45007f82a84c39f42be1

See more details on using hashes here.

Supported by

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