A module for Django that allows to build pattern libraries for your projects.
Project description
Django pattern library
A module for Django that helps you to build pattern libraries and follow the Atomic design methodology.
Objective
At the moment, the main focus is to allow developers and designers use exactly the same Django templates in a design pattern library and in production code.
There are a lot of alternative solutions for building pattern libraries already. Have a look at Pattern Lab and Astrum, for example. But at Torchbox we mainly use Python and Django and we find it hard to maintain layout on big projects in several places: in a project's pattern library and in actual production code. This is our attempt to solve this issue and reduce the amount of copy-pasted code.
Documentation
Documentation is located here.
How to install
-
Add
pattern_library
into yourINSTALLED_APPS
:INSTALLED_APPS = [ # ... 'pattern_library', # ... ]
-
Add
pattern_library.loader_tags
into theTEMPLATES
setting. For example:TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'builtins': ['pattern_library.loader_tags'], }, }, ]
Note that this module only supports the Django template backend out of the box.
-
Set the
PATTERN_LIBRARY_TEMPLATE_DIR
setting to point to a template directory with your patterns:PATTERN_LIBRARY_TEMPLATE_DIR = os.path.join(BASE_DIR, 'project_styleguide', 'templates')
Note that
PATTERN_LIBRARY_TEMPLATE_DIR
must be available for template loaders. -
Include
pattern_library.urls
into yoururlpatterns
. Here's an exampleurls.py
:from django.apps import apps from django.conf.urls import url, include
urlpatterns = [ # ... Your URLs ]
if apps.is_installed('pattern_library'): urlpatterns += [ url(r'^pattern-library/', include('pattern_library.urls')), ]
Contributing
See anything you like in here? Anything missing? We welcome all support, whether on bug reports, feature requests, code, design, reviews, tests, documentation, and more. Please have a look at our contribution guidelines.
If you just want to set up the project on your own computer, the contribution guidelines also contain all of the setup commands.
Credits
View the full list of contributors. BSD licensed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-pattern-library-0.2.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fbf41c4dae29a8c16d075b9e9745d3321bd5cd88dc16ef053a939c91eeb30f1 |
|
MD5 | c0f396cbaaa6d6089a9026d0808d5f11 |
|
BLAKE2b-256 | becc656e9e595a227113768407f4a4a0296e644a9ae014bf88325cdbee23a76d |
Hashes for django_pattern_library-0.2.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 144e78660486bcb7351109ac12d32e718f9c9816c1f2d21813e0c5a6b20c1726 |
|
MD5 | ea268272e496a47b34f74662223e665b |
|
BLAKE2b-256 | 7d114beda9753186e24202fa01570ca45969ced136f08178173d292d1a84e1e8 |