我正在关注 django 页面,该页面解释了如何显示图像https://docs.djangoproject.com/en/1.6/howto/static-files/
而且我认为我做了所有指定的事情,例如:
设置.py
STATIC_ROOT = BASE_DIR + '/static'
STATIC_URL = '/static/'
INSTALLED_APPS += ('django.contrib.staticfiles',)
模型.py
image = models.ImageField(upload_to="static/my_app/")
def image_tag(self):
if self.image:
return u'<img src="{0}" />'.format("/" + self.image.url)
网址.py
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
管理员.py
list_display = ('description', 'image_tag',)
但我的形象没有出现。我错过了什么?