Issue
code example
tooltip file
searching for the correct path
FILES:
settings.py STATICFILES_DIRS = [ BASE_DIR / "static" , ]
base.html {% load static %}
How do I reference my static files in the following line of html code?...
<li class="ftco-animate"><a href="#" data-toggle="tooltip" data-placement="top" title="Facebook"><span class="ion-logo-facebook"></span></a></li>
i.e. {% static 'website/...' %}
Solution
As described in the docs, assuming your filepath is BASE_DIR/static/sub_dir/example.pdf you can reference it like this:
<li class="ftco-animate">
<a href="{% static 'sub_dir/example.pdf' %}" data-toggle="tooltip" data-placement="top" title="Facebook">
<span class="ion-logo-facebook"></span>
</a>
</li>
It is good practice to place your static files in a sub-directory named same as your app name. That way, it will be much easier to reference the files from different apps later on. That is why the example in the docs says {% static 'my_app/example.jpg' %}.
Also please make sure you go through the documentations and follow all the steps mentioned there.
Answered By - Sakib Hasan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.