“Medien -URL Django” Code-Antworten

Medien -URL 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

Medien -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)

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

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

Condemned Chamois

Wo wir das Bild im Django -Projekt speichern können, damit T in der HTML -Datei arbeiten kann

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

Django Media URL

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

Ähnliche Antworten wie “Medien -URL Django”

Fragen ähnlich wie “Medien -URL Django”

Weitere verwandte Antworten zu “Medien -URL Django” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen