“Django Media URL” 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 “Django Media URL”

Fragen ähnlich wie “Django Media URL”

Weitere verwandte Antworten zu “Django Media URL” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen