“URL statis Django” Kode Jawaban

Template Django saya tidak ingin memuat file statis

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "/static/")

STATICFILES_DIRS = ( 
    STATIC_ROOT,        
)
Cooperative Copperhead

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

Impor statis di URL Django

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

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Clever Constrictor

File / Templat 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

URL 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)
Helpless Hamster

Jawaban yang mirip dengan “URL statis Django”

Pertanyaan yang mirip dengan “URL statis Django”

Lebih banyak jawaban terkait untuk “URL statis Django” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya