Skip to main content

Django integration with Webpack Encore

Project description

Django Encore

This library integrates Webpack Encore into your Django application like it does Webpack Encore Bundle for Symfony.

Usage

  1. Install the library from PyPI:
pip install django-encore
  1. 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'
  1. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-encore-0.0.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_encore-0.0.2-py3.6.egg (3.1 kB view details)

Uploaded Egg

django_encore-0.0.2-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-encore-0.0.2.tar.gz.

File metadata

  • Download URL: django-encore-0.0.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-encore-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d53f99bc5475b2aec272f192c8867634645ad0d944e619fbea767fc1712d2316
MD5 409f955c285f4dbe95056b198baaedd6
BLAKE2b-256 c9ed2838ebfb28b13d61502c973b30dbee29d12c3b1652cb7f94a5055a976ee1

See more details on using hashes here.

File details

Details for the file django_encore-0.0.2-py3.6.egg.

File metadata

  • Download URL: django_encore-0.0.2-py3.6.egg
  • Upload date:
  • Size: 3.1 kB
  • Tags: Egg
  • Uploaded using 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

File hashes

Hashes for django_encore-0.0.2-py3.6.egg
Algorithm Hash digest
SHA256 a597ecf2335547515d5bc1642a11ab05586a842c83e995ade4e9c8ed4aceeb5a
MD5 0217d09f5f7ad62fd3c475f916ca8fee
BLAKE2b-256 b38e384ae572d176de19bb0a99115b93cc2a387e8f10243f85f76b527f3f5472

See more details on using hashes here.

File details

Details for the file django_encore-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: django_encore-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for django_encore-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3508c601dbc867c0b42a45e6161d3f4ea62a0e0481041fe4a2879fa5c932ab95
MD5 7c59b300fcd8286e3e7e86aa30480d52
BLAKE2b-256 2673b88a7a9905f480cad43f01d785dab558da6f9f3c27bce2bb5de11750afe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page