You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current documentation misleads that django-assets will work with Django and Jinja2. It will not, not out of the box at least.
Steps to reproduce
Add 'webassets' and 'django_assets' to INSTALLED_APPS
Add 'django_jinja.backend.Jinja2' (or 'django.template.backends.jinja2') to TEMPLATES
Add 'webassets.ext.jinja2.AssetsExtension' to Jinja2 extensions
Add {% assets "js/main.js", output="min/main.js" %}{% endassets %} to your template file
What happens
File "/Users/semenov/test/var/venv/lib/python3.5/site-packages/webassets/ext/jinja2.py" in _render_assets
Exception Type: RuntimeError at /test/
Exception Value: No assets environment configured in Jinja2 environment
Expected
The environment should be automatically configured; or it should be clearly documented how to configure it manually.
Problem
The current documentation misleads that django-assets will work with Django and Jinja2. It will not, not out of the box at least.
Steps to reproduce
'webassets'
and'django_assets'
toINSTALLED_APPS
'django_jinja.backend.Jinja2'
(or'django.template.backends.jinja2'
) toTEMPLATES
'webassets.ext.jinja2.AssetsExtension'
to Jinja2 extensions{% assets "js/main.js", output="min/main.js" %}{% endassets %}
to your template fileWhat happens
Expected
The environment should be automatically configured; or it should be clearly documented how to configure it manually.
Current workaround
Create a custom extension:
then add
myapp.jinja2_assets.AssetsExtension
to the list of Jinja2 extensions.The text was updated successfully, but these errors were encountered: