Skip to main content

The National Archives frontend Django templates

Project description

The National Archives Frontend Django Templates

Main build status Latest release PyPi version Python version Licence

Django templates implementation of TNA components for inclusion in Python Django applications.

# Create a virtual environment
python3 -m venv venv
. ./venv/bin/activate

# Install the dependencies
pip install -r requirements.txt
npm install

# Run the server
python manage.py runserver 8080

http://localhost:8080/

# Run the tests against the running server
node tasks/test.mjs

How to use in your own Django project

Templates

  1. Install the nationalarchives-frontend-django package from PyPi
from distutils.sysconfig import get_python_lib

TEMPLATES = [
    {
        "DIRS": [
            os.path.join(get_python_lib(), "nationalarchives-frontend-django/templates")
        ],
    }
]

Styles

Install the @nationalarchives/frontend package from npm with npm install @nationalarchives/frontend

Add the config to enable you to use the static files:

STATICFILES_DIRS = [
    "node_modules/@nationalarchives/frontend"
]

Import the stylesheet with:

{% load static %}
<link rel="stylesheet" href="{% static 'nationalarchives/all.css' %}">

The @nationalarchives/frontend package also includes the SCSS if you wish to compile the CSS yourself.

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

nationalarchives-frontend-django-0.1.2a0.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

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