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')), ]
Developer docs
Developer docs can be found here.
TODO
- Add a note about production usage
- Tests: Add tests. It's ok to not bother about tests during prototyping, but it will be extremely hard to maintain the project without tests.
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
File details
Details for the file django-pattern-library-0.2.5b2.tar.gz
.
File metadata
- Download URL: django-pattern-library-0.2.5b2.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0b2 CPython/3.7.5 Linux/5.3.6-200.fc30.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7dfa66201a0cae0acbb7f6545e5179cf4312cf70f64dd8f55bc415f9be1dfca |
|
MD5 | 40956aa7690b8920c4d6da9b4339cda9 |
|
BLAKE2b-256 | 7ba31157e04d2726a23d4c66da6e255467dfcb8507d73421a2781a4d26ccf576 |
File details
Details for the file django_pattern_library-0.2.5b2-py3-none-any.whl
.
File metadata
- Download URL: django_pattern_library-0.2.5b2-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0b2 CPython/3.7.5 Linux/5.3.6-200.fc30.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2977d2bfe4515dfe896785bb3efc10f3e605f740556e494e1287826b77d12e8e |
|
MD5 | c4f41b4ed231f1ef757e2499a6ba463b |
|
BLAKE2b-256 | 42da7448df0e275fae7c267778ae9e71e51be60a65556411aee1bd649befaab9 |