Answer the question
In order to leave comments, you need to log in
How can I make the search image appear on all pages?
Hey! An image appears behind the search button in the form.
<form id="search" action="{% url 'Home_page_url' %}" method="
{% csrf_token %}
<input id="head-form" type="search" placeholder="Поиск..." maxlength="50"
name="search">
<input type="image" src="static/img/search2.png">
</form>
Answer the question
In order to leave comments, you need to log in
Before taking on Django, it's worth learning the basics. Specifically, what are relative and absolute URLs.
Well, the Django documentation on maintaining statics is also worth reading so as not to hardcode paths.
<input type="image" src="{% static 'img/search2.png' %}">
To be sure to catch static, you need to run the collectstatic command. It will collect all the dependencies of the project into a statics folder and hardcoded paths will work from there.
As for the rest, I agree with the authors of the previous speakers, you need to read the documentation. In the project deployment example, all this is painted at the “copy and work” level.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question