The code below makes error.. How could I resolve this problem?
{% block header %} <link rel="stylesheet" href="{% static 'shop/style.css' %}" /> {% endblock %}
The error output:
TemplateSyntaxError : Invalid block tag: 'static', expected 'endblock'
The very first line in the file, {% load static %} , uses Django's special template tag syntax to tell the template engine to use the files in the static folder in this template.
django. contrib. staticfiles collects static files from each of your applications (and any other places you specify) into a single location that can easily be served in production. For an introduction to the static files app and some usage examples, see How to manage static files (e.g. images, JavaScript, CSS).
Local Development. For local development the Django web server automatically serves static files and minimal configuration is required. A single Django project often contains multiple apps and by default Django will look within each app for a static directory containing static files.
No, it is not impossible. Try including {% load staticfiles%}
in the same html file, rather than attempting to inherit it from some base.html
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With