<commit_before>django layers
=============

This package provides support for "layers" of templates and static resources
that can be selecting depending on the request context.

WARNING: The API documented below may change significantly before version 1.0

Why?
----

Using layers you can provide alternative sets of templates ("skins")
depending on different contexts. For example, using the same CMS you
can, from a single code base, host different frontend designs, have
a different visitor/admin frontend, do A/B testing, etc.

All of this within the same instance (so no separate instances each running
with their own settings.py configuration)


How?
----

pip/easy_install this package, django_layers

Then add 'layers.middleware.LayerLoaderMiddleware' to your
MIDDLEWARE_CLASSES, e.g.

    MIDDLEWARE_CLASSES = (
        'layers.middleware.LayerLoaderMiddleware',
        ...
    )

Also, add 'layers.loader.LayerLoader' to your TEMPLATE_LOADERS, e.g.

    TEMPLATE_LOADERS = (
        'layers.loader.LayerLoader',
        ...
    )

Optionally, if you have separate collections of static resources for each layer,
add 'layers.finders.AppLayerFinder' as the first STATICFILE_FINDERS:
<commit_msg>Doc update, fixes #2<commit_after>django layers
=============

This package provides support for "layers" of templates and static resources
that can be selecting depending on the request context.

WARNING: The API documented below may change significantly before version 1.0

Why?
----

Using layers you can provide alternative sets of templates ("skins")
depending on different contexts. For example, using the same CMS you
can, from a single code base, host different frontend designs, have
a different visitor/admin frontend, do A/B testing, etc.

All of this within the same instance (so no separate instances each running
with their own settings.py configuration)


How?
----

pip/easy_install this package, django_layers

Then add 'layers.middleware.LayerLoaderMiddleware' to your
MIDDLEWARE_CLASSES, e.g.

    MIDDLEWARE_CLASSES = (
        'layers.middleware.LayerLoaderMiddleware',
        ...
    )

Also, add 'layers.loader.LayerLoader' at the top of your TEMPLATE_LOADERS, prior
to any other/django loaders. E.g.

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

Optionally, if you have separate collections of static resources for each layer,
add 'layers.finders.AppLayerFinder' as the first STATICFILE_FINDERS:

{'fraction_non_alphanumeric': 0.079296875, 'fraction_numerical': 0.001953125, 'mean_word_length': 4.02156862745098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4054552', 'n_tokens_mistral': 721, 'n_tokens_neox': 691, 'n_words': 279}