“File / Templat Statis Django” Kode Jawaban

cara menambahkan file statis di django

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
    BASE_DIR / 'static'
]
Ashamed Anaconda

Muat file statis di django

{% load static %}
<img src="{% static 'my_app/example.jpg' %}" alt="My image">
Enthusiastic Emu

File / Templat Statis Django

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Nyn

File statis Django

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
    '/var/www/static/',
]
Nyn

File statis Django

{% load static %}
<img src="{% static "my_app/example.jpg" %}" alt="My image">
Motionless Marten

File statis Django

STATICFILES_DIRS = [
    BASE_DIR / "static",
]
Worrisome Whale

Jawaban yang mirip dengan “File / Templat Statis Django”

Pertanyaan yang mirip dengan “File / Templat Statis Django”

Lebih banyak jawaban terkait untuk “File / Templat Statis Django” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya