我后台编辑器用的是kindeditor,在编辑器中也实现了图片上传功能,我每发表一篇文章在前台都会有缩率图,请问在模版<img src="">中调用图片的地址该如何写?,新手请教各位,谢谢!
上传成功后返回的图片地址是这种样式: /uploads/kindeditor/2016/3/2016-03-31-215316.jpg
url.py settings.py 都已经配置好了。代码如下:
url.py
urlpatterns = [
url(r"^uploads/(?P<path>.*)$", "django.views.static.serve",
{"document_root": settings.MEDIA_ROOT, }),
url(r'^admin/upload/(?P<dir_name>[^/]+)$',
upload_image, name='upload_image'),
]
settings.py
MEDIA_URL='/uploads/'
MEDIA_ROOT=os.path.join(BASE_DIR, 'uploads')
认证0级讲师