您的位置:首页 > 编程语言 > Go语言

django图片显示配置

2014-05-16 16:42 260 查看
https://github.com/asmcos/djcms/blob/master/iosnew/settings.py https://github.com/asmcos/djcms/blob/master/iosnew/urls.py
MEDIA_ROOT =  os.path.join(BASE_DIR,'media')

MEDIA_URL = '/media/'

#  url(r'^image/(?P<path>.*)$','django.views.static.serve',

#        {'document_root': settings.MEDIA_ROOT+'/image', 'show_indexes':True}),

url.py里面:

  url(r'^media/(?P<path>.*)$','django.views.static.serve',

        {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),

模板里面:

<img src="/media/photos/{{e.image}}"    />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐