Django Encore
This library integrates Webpack Encore into your Django application like it does Webpack Encore Bundle for Symfony.
Usage
- Install the library from PyPI:
pip install django-encore
- Configure your settings.py file:
Include the library:
INSTALLED_APPS = [
# ...
'encore',
]
Add ENCORE_ENTRYPOINTS_FILE and change STATICFILES_DIRS:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'assets_build'),
]
ENCORE_ENTRYPOINTS_FILE = os.path.join(BASE_DIR, 'assets_build') + '/build/entrypoints.json'
- Use template tags in your templates:
{% load encore %}
{% block javascripts %}
{{ block.super }}
{% encore_entry_script_tags 'demo1' %}
{% endblock %}
{% block stylesheets %}
{{ block.super }}
{% encore_entry_link_tags 'demo1' %}
{% endblock %}
See the example folder for more details.
Development
First of all, install dependencies by pipenv:
cd example/webapp
pipenv install --dev
pipenv shell # to shell with virtual environment
Second, build files using Encore:
npm run dev
Then you can start the web server:
python manage.py runserver
Metadata
Release files for django-encore 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-encore-0.0.2.tar.gz | 2.8 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_encore-0.0.2-py3.6.egg | Legacy Egg format | - | - | Details |
| django_encore-0.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / django-encore-0.0.2.tar.gz
| Download URL | django-encore-0.0.2.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d53f99bc5475b2aec272f192c8867634645ad0d944e619fbea767fc1712d2316
|
|
BLAKE2b-256 checksum How to use checksums |
c9ed2838ebfb28b13d61502c973b30dbee29d12c3b1652cb7f94a5055a976ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9
|
Release files / django_encore-0.0.2-py3.6.egg
| Download URL | django_encore-0.0.2-py3.6.egg |
|---|---|
| Size | 3.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
a597ecf2335547515d5bc1642a11ab05586a842c83e995ade4e9c8ed4aceeb5a
|
|
BLAKE2b-256 checksum How to use checksums |
b38e384ae572d176de19bb0a99115b93cc2a387e8f10243f85f76b527f3f5472
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9
|
Release files / django_encore-0.0.2-py2.py3-none-any.whl
| Download URL | django_encore-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
3508c601dbc867c0b42a45e6161d3f4ea62a0e0481041fe4a2879fa5c932ab95
|
|
BLAKE2b-256 checksum How to use checksums |
2673b88a7a9905f480cad43f01d785dab558da6f9f3c27bce2bb5de11750afe2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9
|