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_libraryinto yourINSTALLED_APPS:INSTALLED_APPS = [ # ... 'pattern_library', # ... ]
-
Add
pattern_library.loader_tagsinto theTEMPLATESsetting. 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_DIRsetting 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_DIRmust be available for template loaders. -
Include
pattern_library.urlsinto 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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_pattern_library-0.2.2-py3-none-any.whl.
File metadata
- Download URL: django_pattern_library-0.2.2-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d4d9aad2fb51d6f81e2b315b8c29dbbe09944643a1d537207367d5cf09ac6d
|
|
| MD5 |
68981c4b66a0052c5c3a3eca6762ec6b
|
|
| BLAKE2b-256 |
b4ad8fd1e27bba8ef17497cfe241d15b61396a34987b1db1a69936589e38023d
|