I already have S3storage working for another part of my project using
that same method, but when I try to save a Photo in Photologue, I get
an error saying that my storage backend (S3), does not support
absolute paths. I figured out that the admin_thumnail method is
causing the problem. When I remove it from the list_display, the error
goes away. Is there a way to edit admin_thumbnail so i can still view
photos from the admin?
Here is the complete error message:
Environment:
Request Method: GET
Request URL:
http://localhost:8000/admin/photologue/photo/
Django Version: 1.0-final-SVN-8964
Python Version: 2.5.1
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.humanize',
...
'photologue']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')
Template error:
In template /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/contrib/admin/templates/admin/
change_list.html, error at line 34
Caught an exception while rendering: This backend doesn't support
absolute paths.
24 : {% if cl.has_filters %}
25 : <div id="changelist-filter">
26 : <h2>{% trans 'Filter' %}</h2>
27 : {% for spec in cl.filter_specs %}
28 : {% admin_list_filter cl spec %}
29 : {% endfor %}
30 : </div>
31 : {% endif %}
32 : {% endblock %}
33 :
34 : {% block result_list %} {% result_list cl %} {% endblock %}
35 : {% block pagination %}{% pagination cl %}{% endblock %}
36 : </div>
37 : </div>
38 : {% endblock %}
39 :
Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/handlers/base.py" in get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/sites.py" in root
158. return self.model_page(request, *url.split('/',
2))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/sites.py" in model_page
177. return admin_obj(request, rest_of_url)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/options.py" in __call__
189. return self.changelist_view(request)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/options.py" in changelist_view
662. ], context,
context_instance=template.RequestContext(request))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/shortcuts/__init__.py" in render_to_response
18. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader.py" in render_to_string
107. return t.render(context_instance)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
768. bits.append(self.render_node(node, context))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/debug.py" in render_node
71. result = node.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader_tags.py" in render
97. return compiled_parent.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
768. bits.append(self.render_node(node, context))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/debug.py" in render_node
71. result = node.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader_tags.py" in render
97. return compiled_parent.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
768. bits.append(self.render_node(node, context))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/debug.py" in render_node
71. result = node.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader_tags.py" in render
24. result = self.nodelist.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
768. bits.append(self.render_node(node, context))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/debug.py" in render_node
71. result = node.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/loader_tags.py" in render
24. result = self.nodelist.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/__init__.py" in render
768. bits.append(self.render_node(node, context))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/template/debug.py" in render_node
81. raise wrapped
Exception Type: TemplateSyntaxError at /admin/photologue/photo/
Exception Value: Caught an exception while rendering: This backend
doesn't support absolute paths.
Original Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/template/debug.py", line 71, in
render_node
result = node.render(context)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/template/__init__.py", line 915, in
render
dict = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/contrib/admin/templatetags/
admin_list.py", line 242, in result_list
'results': list(results(cl))}
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/contrib/admin/templatetags/
admin_list.py", line 237, in results
yield list(items_for_result(cl,res))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/contrib/admin/templatetags/
admin_list.py", line 161, in items_for_result
value = attr()
File "/Users/.../Sites/.../photologue/models.py", line 276, in
admin_thumbnail
(self.get_absolute_url(), func())
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/utils/functional.py", line 55, in
_curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/Users/.../Sites/.../photologue/models.py", line 308, in
_get_SIZE_url
if not self.size_exists(photosize):
File "/Users/.../Sites/.../photologue/models.py", line 337, in
size_exists
if os.path.isfile(func()):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/utils/functional.py", line 55, in
_curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/Users/.../Sites/.../photologue/models.py", line 316, in
_get_SIZE_filename
return os.path.join(self.cache_path(),
File "/Users/.../Sites/.../photologue/models.py", line 284, in
cache_path
return os.path.join(os.path.dirname(self.image.path), "cache")
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/db/models/fields/files.py", line 49, in
_get_path
return self.storage.path(
self.name)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/core/files/storage.py", line 81, in
path
raise NotImplementedError("This backend doesn't support absolute
paths.")
NotImplementedError: This backend doesn't support absolute paths.