Django Media Url

[Solved] Django Media Url | Basic - Code Explorer | yomemimo.com
Question : media url django

Answered by : jocelyn

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

Source : https://stackoverflow.com/questions/5517950/django-media-url-and-media-root | Last Update : Mon, 28 Dec 20

Question : media url django

Answered by : condemned-chamois-xmmve66rgq4b

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)

Source : https://docs.djangoproject.com/en/4.0/howto/static-files/ | Last Update : Mon, 03 Jan 22

Question : where we can store image in django project to so that t can work in html file

Answered by : victorious-vendace-c4luz8fbospt

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

Source : https://docs.djangoproject.com/en/3.1/howto/static-files/ | Last Update : Thu, 26 Nov 20

Question : django media url

Answered by : magnificent-mosquito-drynsqwab2mx

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)

Source : https://learnbatta.com/course/django/django-static-files-usage/ | Last Update : Mon, 15 Nov 21

Answers related to django media url

Code Explorer Popular Question For Basic