I have successfully followed the popular solution for serving static files in Django:
- I have
/myproject/myapp/static/favicon.ico
- I use
<link rel="icon" href="{%static 'favicon.ico' %}" />
in my html template
But if I omit the <link rel...>
from html then the browser will by default try to GET /favicon.ico
which predictably logs
Not Found: /favicon.ico
How can I tell Django "if anything in urlpatterns
does not match the GET string, and that GET string matches a file within a certain directory, just serve that file"?
(Then I would be able to write e.g. <script src="/script.js">
and have /myproject/myapp/static-or-wherever/script.js
be served without using {% use static %}
in a template -- e.g. if I browse to http://my-site.com/script.js
manually.)