imagefield - How to render images on Django template -


see github

https://github.com/rg3915/gallery

how render images on django template? returning:

gallery

media/3665_1280x800_8ux8tgg.jpg

tour de france

media/281405_fsrbdzu.jpg

bike of children

how render images?

does bug in settings.py

urls.py

from django.conf import settings django.conf.urls import patterns, include, url django.conf.urls.static import static gallery.core.views import * django.contrib import admin  urlpatterns = patterns(     'gallery.core.views',     url(r'^$', 'home', name='home'),     url(r'^gallery/$', gallerylist.as_view(), name='gallery_list'),     url(r'^admin/', include(admin.site.urls)), ) + static(settings.media_url, document_root=settings.media_root) 

settings.py

media_root = base_dir.child('media') media_url = '/media/'  static_root = base_dir.child('staticfiles') static_url = '/static/' 

gallery_list.html

<html> <body>     <h1>gallery</h1>      {% if gallery %}         {% photo in gallery %}             <p><img src="{{ photo.photo.url }}" width="300px"></p>             <p>{{ photo.description }}</p>         {% endfor %}     {% endif %}  </body> </html> 

the secret photo.photo.url


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -