demonno
demonno

Reputation: 524

Ignore external sources being compressed in mezzanine

Tring to load external source in contact form template, mezzanine

Example

{% block extra_js %}
{{ block.super }}    
    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
{% endblock %}

Compressor exception

compressor.exceptions.UncompressableFileError: 'https://www.google.com/recaptcha/api.js' isn't accessible via COMPRESS_URL ('/static/') and can't be compressed

Upvotes: 0

Views: 82

Answers (2)

David A
David A

Reputation: 191

There might be a problem with a new formatter you have added to serialize a model - try adding a try catch block to it to remove the error

Upvotes: 0

Steve
Steve

Reputation: 1736

Put the script tag inside the {% extra_head %} block instead of the {% extra_js %} block. If you look at the base template you'll see everything in {% extra_js %} gets compressed via {% compress %}:

https://github.com/stephenmcd/mezzanine/blob/bec6595fc960013aaa4d590d842acff6d206f20b/mezzanine/core/templates/base.html#L34-L39

Upvotes: 1

Related Questions