1
并感谢您花时间阅读我的问题。Google App Engine中的get_serving_url在生产中失败时呈现InvalidBlobKeyError,同时呈现
我已经成功地在窗体中实现了用户上传。我也成功地在我的发布服务器上显示上传的文件(图像)。
但是,我无法让它们在生产中显示。
我目前使用下面的过滤器图片:
@register.simple_tag
def media_file_url(file_obj):
file_location = file_obj.name.split('/')[0]
#gives just the key
return get_serving_url(str(file_location))
,并在模板:
<img class='visual' src='{% media_file_url promotion.image %}'
alt='image description' width='70' height='88' />
我已经尝试了上面,不要把file_location。
我已经尝试了自定义的处理器在views.py如下:
def images(request, resource):
clean_key = urllib2.unquote(resource)
return HttpResponseRedirect(get_serving_url(clean_key))
所有开发上面的工作,而不是生产。
有没有人有任何建议?
谢谢!
为什么你不使用MEDIA_URL? – catherine 2013-02-10 11:40:00
看看这个关于创建和使用get_serving_url的问题:http://stackoverflow.com/questions/13810823/python-google-app-engine-image-object – voscausa 2013-02-10 12:19:33
cathy:我试过了,也在dev上工作,不是prod 。 @voscausa:Django有点不同 - 和文档的链接是我用来试图渲染这个图像的。 感谢您的意见! – hgolov 2013-02-10 13:15:40