1STATIC_URL = '/static/'
2STATIC_ROOT = os.path.join(BASE_DIR, "/static/")
3
4STATICFILES_DIRS = (
5 STATIC_ROOT,
6)
7
1from django.conf import settings
2from django.conf.urls.static import static
3
4urlpatterns = [
5 # ... the rest of your URLconf goes here ...
6] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
7
1{% load static %}
2<img src="{% static "my_app/example.jpg" %}" alt="My image">
3
1#In your templates, use the static template tag to build the URL for the given relative path using the configured STATICFILES_STORAGE.
2{% load static %}
3<img src="{% static 'my_app/example.jpg' %}" alt="My image">
1STATICFILES_DIRS = [
2 os.path.join(BASE_DIR, "static"),
3 '/var/www/static/',
4]
5