“Django Media URL” Respostas de código

URL de mídia 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 de mídia 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

onde podemos armazenar a imagem no projeto django para que t possa funcionar no arquivo html

{% 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

Respostas semelhantes a “Django Media URL”

Perguntas semelhantes a “Django Media URL”

Mais respostas relacionadas para “Django Media URL” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código