Skip to main content
Release file added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Django Layers

Travis

Travis


django-layers-hr makes it possible to serve a set of templates and static resources as defined in settings.py. This means you can serve different HTML, Javascript and CSS to eg. basic mobile devices, smart phones and desktop browsers. These template sets (aka layers) also stack, so if you create foo.html for basic devices it is automatically available for desktop browsers as well. You can override foo.html for desktop browsers.

Installation

  1. Install or add django-layers-hr to your Python path.

  2. Add layers to your INSTALLED_APPS setting.

  3. Ensure the app that you will be creating layers for appears first in INSTALLED_APPS else template override won’t work.

Example

Note: there is a working example in the example subdirectory.

We have sites example.com, basic.example.com and smart.example.com. Each of the sites have their own settings.py, thus different Django processes.

Directory structure

templates
    - basic
        - foo.html (1)
        - bar.html (2)
    - smart
        - bar.html (3)
    - web
        - bar.html (4)

static
    - basic
        - foo.css (5)
        - bar.css (6)
    - smart
        - bar.css (7)
    - web
        - bar.css (8)

Settings

We define an “inheritance” hierarchy.

  • Desktop settings has LAYERS = {'layers': ['basic', 'web']}.

  • Basic settings has LAYERS = {'layers': ['basic']}.

  • Smart settings has LAYERS = {'layers': ['basic', 'smart']}.

All settings require loaders and finders to be set. The order is important.

INSTALLED_APPS = (
    'myapp',
    'layers',
    ...
)

TEMPLATE_LOADERS = (
    'layers.loaders.filesystem.Loader',
    'django.template.loaders.filesystem.Loader',
    'layers.loaders.app_directories.Loader',
    'django.template.loaders.app_directories.Loader',
)

STATICFILES_FINDERS = (
    'layers.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'layers.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

Template results

Static results

Overriding templates from other apps

The normal template resolution rules apply. Creating eg. templates/web/registration/login.html will override the login page for web only.

Collectstatic

Collectstatic remains unaffected. The collector delegates to finders, so all layer aware resources end up with partial paths under the STATIC_ROOT directory.

Authors

  • Hedley Roos

Changelog

0.2

  1. Inevitable package rename.

0.1

  1. Initial release.

Metadata

Release files for django-layers-hr 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for django-layers-hr 0.2
File Size Uploaded Provenance Actions
django-layers-hr-0.2.tar.gz 11.8 kB File added late: Without provenance Details for django-layers-hr-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-layers-hr 0.2
File Interpreter ABI Platform Actions
django_layers_hr-0.2-py2.7.egg Legacy Egg format - - Details for django_layers_hr-0.2-py2.7.egg

Total release size: 23.5 kB

Release files / django-layers-hr-0.2.tar.gz

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL django-layers-hr-0.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
df9a8ceddd49dacb1e6b1054f56bd30dd8d12200f2d0c40e1f09b4700777720e
BLAKE2b-256 checksum
How to use checksums
f0e82623904794c41df581b50fb64d4f05d294ed46b456e48129a2ac033dd218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_layers_hr-0.2-py2.7.egg

Download URL django_layers_hr-0.2-py2.7.egg
Size 11.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
090723c512cdb34cf72c51a4cbd07dfec5c69433a932d0b34879eaa6f5586ff7
BLAKE2b-256 checksum
How to use checksums
11faf513636775cb0c0120482d67af959ccdde7a43de91384b0626dd855c9b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-layers-hr 0.2

Upload timing

Release file added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.


Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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