django+python开发的网站怎么静态引用img图片

来源:互联网 发布:施工计划横道图软件 编辑:程序博客网 时间:2024/04/30 10:52

html中引用图片路径:

    <p><img src="/site_media/abc.gif" mce_src="site_media/abc.gif" ></p>

url.py添加配置:

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'csvt02.views.home', name='home'),
    # url(r'^csvt02/', include('csvt02.foo.urls')),


    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),


    # Uncomment the next line to enable the admin:
    # url(r'^admin/', include(admin.site.urls)),

    url(r'^index/$','blog.views.index'),


   (r'^site_media/(?P<path>.*)','django.views.static.serve',{'document_root':'E:/workspace/csvt02/img'}),
)



0 0