Python Django模板中的某些页面中未显示图像

Python Django模板中的某些页面中未显示图像,python,django,image,sorl-thumbnail,Python,Django,Image,Sorl Thumbnail,这是文件结构: myApp/ 媒体文件/ 照片 麦斯特/ 模板/ 麦斯特/ index.html images.html profile.html 我的图像通过以下设置保存到media文件/照片: TEMPLATE_DIRS, MEDIA_ROOT = [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'mediafiles')] MEDIA_URL = '/mediafiles/' 我有四个URL: url(r'^$',

这是文件结构:

myApp/ 媒体文件/ 照片 麦斯特/ 模板/ 麦斯特/ index.html images.html profile.html

我的图像通过以下设置保存到
media文件/照片

TEMPLATE_DIRS, MEDIA_ROOT = [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'mediafiles')]
MEDIA_URL = '/mediafiles/'
我有四个
URL

url(r'^$', views.index, name='index'),
url(r'^newimage/$', views.newImage, name='profile_photo'),
url(r'^user/(?P<user_name>\w+)/$', views.profile, name='profile'),
url(r'^books/(?P<book_id>\d+)/(?P<book_name>[-\w]+)/$', views.book_profile, name='book_profile'),

我做错了什么,如何正确地做?

告诉谁是问题的根源@拉贾西蒙:第三个
url
。正如我在问题中所说。图像不显示在那里。它显示一个方形框。好的。。你检查了缓存文件夹中创建的缓存映像了吗?@rajasimon:在那里。即使是图像。看起来您可能有一些安装问题。。
url(r'^$', views.index, name='index'),
#the image tag below display my image correctly
<img src=".{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">

url(r'^newimage/$', views.newImage, name='profile_photo'),
#the image tag below display my image correctly
<img src="..{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">

url(r'^user/(?P<user_name>\w+)/$', views.profile, name='profile'),
#all the image tags below display my image correctly
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
<img src=".{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
<img src="...{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">