“URL Media Django” Kode Jawaban

URL Media Django

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

urlpatterns=[
# define all urls
			]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

#other method
urlpatterns = patterns('',
    # ... the rest of your URLconf goes here ...
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
BlueMoon

URL Media 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)

# ----------------or----------------

# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Condemned Chamois

di mana kita dapat menyimpan gambar dalam proyek django sehingga t dapat bekerja dalam file html

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

URL Django Media

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)
Magnificent Mosquito

Jawaban yang mirip dengan “URL Media Django”

Pertanyaan yang mirip dengan “URL Media Django”

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

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya