1๐
โ
^media/$
is a very wrong regex for media files. You should delete the $
(end-of-the-string) sign from this regex.
Usually for development environments I use this snippet in the urls.py
:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = patterns('',
...
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Also remove the useless {{ MEDIA_ROOT }}
part from your template code. It should be:
<img src="{{ image.picture.url }}" />
๐คcatavaran
0๐
In adition the line that you have to add is..
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = patterns('',
...
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
But it has to be in the urls.py of your project folder. not in the urls.py of your App folder. I knew it by mistake.
๐คheber camargo
- [Answer]-Celery with Django โ AttributeError: 'AsyncResult' object has no attribute 'replace'
- [Answer]-Bootstrap in Python File .py
- [Answer]-Is calling is_valid() on a form that has hidden values required?
- [Answer]-Django CreateView demands pk
- [Answer]-Django throwing error with '/' in url
Source:stackexchange.com