Package: django-govuk-template
This library has not yet been updated to use the newDesign systemIt should be easy to make a Django-based service that follows Government Digital Services’ style guide and reference materials.
Buthttps://pypi.python.org/pypi/govuk-templateis not kept updated and is not readily usable in Django andhttps://github.com/alphagov/govuk_templatecannot 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 fromhttps://github.com/alphagov/govuk_templateand the contents of Node.js packageshttps://www.npmjs.com/package/govuk-elements-sassandhttps://www.npmjs.com/package/govuk_frontend_toolkitNB: Until version 1.0, there is likely going to be a lot of variation in the api, so it’s a good idea to pin a specific minor version.UsageInstall with pip, i.e.pip installdjango-govuk-template. There are 3 optional extras that can also be installed:forms: also installsdjango-govuk-formswhich outputs Django forms using the correct HTML structures for GOV.UK standard stylesscss: allows building SCSS assets with a management commandwatch: use in combination with thescssextra to automatically build SCSS assets while developing locallyDjango project setupSetup a Django project usingmanage.py startprojector other meansInstalldjango-govuk-template(along with desired extras) and addgovuk_template_basetoINSTALLED_APPSCallmanage.py startgovukapp [[app name, e.g. govuk_template]]Add this app toINSTALLED_APPSEnsure that this app is included in source control as the intention is that it’s only rebuilt as neededIf an update is needed in the future, delete the app created in previous step and run this command againAddgovuk_template_base.context_processors.govuk_template_baseto the template context processorsUse[[app name, e.g.govuk_template]].htmlas the template to extend from and overrive theinner_contentblockSee the demo folder in this repository onGitHub, it is not included in distributions.Another demo[1]shows the process of converting the Django tutorial polls app – see the commit history.Service settingsThe service’s title, phase and header/footer links can be configured through service settings objects.Typically, these are stored in theServiceSettingsmodel and initial configuration could be a data migration or a fixture.
However if theGOVUK_SERVICE_SETTINGSsetting is defined, it will take precedence. This is useful in cases where no database is set up.GOVUK_SERVICE_SETTINGS={'name':'Service name','phase':'beta','header_link_view_name':'service_app:home','header_links':[{'name':'Home','link':'service_app:home','link_is_view_name':True},],}Service settings stored in models allow for localisation into different languages.
Setlocalise_nametoTrueand provide translations in your project’s localised messages.DevelopmentPlease report bugs and open pull requests onGitHub.Usepython setup.py testto 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, runpython setup.py makemessages compilemessages.Distribute a new version toPyPiby updating theVERSIONtuple ingovuk_template_baseand runpython setup.py compilemessages sdist bdist_wheel upload.To doAdd browser-sync/equivalent for easier local developmentAdd javascript building optionsAdd additional GOV.UK patternsImprove service setting configurationPerhaps improve SCSS building mechanism (e.g. command line fallback) and print stylesPerhaps improve app naming or documentation regardinggovuk_template_baseandgovuk_templateIt would be nice to require as few external tools as possible (e.g. docker/node/ruby) to make building simplerCopyrightCopyright (C) 2018 HM Government (Ministry of Justice Digital Services).
See LICENSE.txt for further details.[1]https://github.com/ministryofjustice/gov.uk-with-django