我是新來的Django框架,我試圖生成一個鏈接,從下載文件亞馬遜S3。我得到這個錯誤,當我試圖加載模板頁面:使用django從亞馬遜S3下載文件
Reverse for 'myapp.views.handles3downloads' with arguments '(u'README.md',)'
and keyword arguments '{}' not found.
urls.py
urlpatterns = patterns('',
url(r'^handles3downloads/(\d+)/$', handles3downloads),
)
views.py
def handles3downloads(request, fname):
bucket_name = 'bucketname'
key = s.get_bucket(bucket_name).get_key(fname)
dfilename = key.get_contents_to_filename(fname)
wrapper = HttpResponse(file(dfilename))
response = HttpResponse(wrapper, content_type='text/plain')
response['Content-Length'] = os.path.getsize(dfilename)
return response
模板文件
<a href="{% url 'myapp.views.handles3downloads' sfile.linkUrl %}">{{sfile.linkUrl}}</a>
我看了一些類似錯誤的解決方案,但它沒有幫助我。任何人都可以幫助我。
先感謝
看看這有助於:http://stackoverflow.com/questions/625047/django-newbie-reverse-not-found – themanatuf 2013-05-14 11:32:43