Answer the question
In order to leave comments, you need to log in
How to properly set up static in django?
Site structure:
public_html
django
-manage.py
-frontend
--static
---frontend
----favicon.svg
STATIC_URL = '/static/'
STATIC_ROOT = "../public_html/"
<link rel="icon" href="{% static 'frontend/favicon.svg' %}" type="image/svg+xml">
public_html
-frontend
--favicon.svg
Answer the question
In order to leave comments, you need to log in
Well, you yourself specified the URL.
On the other hand, while you are using the dev server ( ), you need to write in the root url.
STATIC_URL = '/static/'
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
After the "python manage.py collectstatic" command, the favicon.svg file is copied to:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question