skip to Main Content

I’m getting templatesyntax error, invalid block on line 66: ‘static’ ; did you forget to register or load this tag.

What am I doing wrong?

I have tried to delete and create the html file again but same error. It only happens in one of my files, others are working well

2

Answers


  1. The top of the template needs to load the static template tags, so:

    {% load static %}
    <!-- rest of the file -->
    Login or Signup to reply.
  2. Could you please check the template raising this error and see if you have the {% load static %} tag at the top of template, before any {% static %} tags. This tag is necessary for using static template tags in Django templates.

    <!-- template_raising_error.html -->
    
    {% load static %}
    <!-- Your HTML code -->
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search