12/30/2010

set image path in django template

add the below to urls.py


site_media = os.path.join( os.path.dirname(__file__), 'site_media' )


in urlpatterns, add this


(r'^site_media/(?P.*)$', 'django.views.static.serve', { 'document_root': site_media } ),


All images or something should be in site_media folder.

In a template file, insert a tag like



댓글 없음: