“Muat file statis di 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

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

Aset statis di Django

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
 
 
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Frail Fowl

Tambahkan file statis di django

STATICFILES_DIRS = [
    BASE_DIR / "static",
    '/var/www/static/',
]
Plain Pheasant

Jawaban yang mirip dengan “Muat file statis di django”

Pertanyaan yang mirip dengan “Muat file statis di django”

Lebih banyak jawaban terkait untuk “Muat file statis di django” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya