Running into errors using S3 backend for Django

1,084 views
Skip to first unread message

vinay

unread,
Sep 15, 2008, 1:01:23 AM9/15/08
to Django users
I have been trying to test the S3 backend for Django.
I am using the code drop from http://code.larlet.fr/doc/django-s3-storage.html
for my default storage as per the instructions on the website. The
storage tests (included in the instructions) went fine with my S3
account.

I have been running into some problems trying to use S3 storage
backend with photologue and I am trying to see if somebody (who know
more about Django than I do) shed some light into the following
error.

Let me know if I need to include additional information.

Thanks
-----------------------------------------------------------------------------------

Request Method: GET
Request URL: http://192.168.0.5:8000/admin/photologue/photo/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: This backend doesn't support
absolute paths.

Original Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
File "/usr/lib/python2.5/site-packages/django/template/__init__.py",
line 915, in render
dict = func(*args)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
templatetags/admin_list.py", line 242, in result_list
'results': list(results(cl))}
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
templatetags/admin_list.py", line 237, in results
yield list(items_for_result(cl,res))
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
templatetags/admin_list.py", line 161, in items_for_result
value = attr()
File "/usr/lib/python2.5/site-packages/photologue/models.py", line
276, in admin_thumbnail
(self.get_absolute_url(), func())
File "/usr/lib/python2.5/site-packages/django/utils/functional.py",
line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/usr/lib/python2.5/site-packages/photologue/models.py", line
308, in _get_SIZE_url
if not self.size_exists(photosize):
File "/usr/lib/python2.5/site-packages/photologue/models.py", line
337, in size_exists
if os.path.isfile(func()):
File "/usr/lib/python2.5/site-packages/django/utils/functional.py",
line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/usr/lib/python2.5/site-packages/photologue/models.py", line
316, in _get_SIZE_filename
return os.path.join(self.cache_path(),
File "/usr/lib/python2.5/site-packages/photologue/models.py", line
284, in cache_path
return os.path.join(os.path.dirname(self.image.path), "cache")
File "/usr/lib/python2.5/site-packages/django/db/models/fields/
files.py", line 49, in _get_path
return self.storage.path(self.name)
File "/usr/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.

Exception Location: /usr/lib/python2.5/site-packages/django/template/
debug.py in render_node, line 81
Python Executable: /usr/bin/python
Python Version: 2.5.2
Python Path: ['/home/vinay/projects/photoalbum', '/usr/lib/python2.5/
site-packages/geopy-0.93-py2.5.egg', '/usr/lib/python2.5/site-packages/
geopy-0.93-py2.5.egg', '/usr/lib/python2.5/site-packages/geopy-0.93-
py2.5.egg', '/home/vinay/projects/photoalbum/utils', '/usr/lib/
python2.5/site-packages', '/home/vinay/projects/photoalbum', '/home/
vinay/projects', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/
lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/
python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/
usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-
packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/
python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0']
Server time: Sun, 14 Sep 2008 21:47:35 -0700
Template error

In template /usr/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



David Zhou

unread,
Sep 15, 2008, 1:16:56 AM9/15/08
to django...@googlegroups.com

On Sep 15, 2008, at 1:01 AM, vinay wrote:

> File "/usr/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.

Sounds like you just need to define that method for the S3 backend.
It's falling back on the base method that spits out the exception.

---
David Zhou
da...@nodnod.net


David Larlet

unread,
Sep 15, 2008, 4:23:32 AM9/15/08
to django...@googlegroups.com

Le 15 sept. 08 à 07:16, David Zhou a écrit :

No, this is explicitly mentioned that you should not implement this
method for storages:
http://docs.djangoproject.com/en/dev/ref/files/storage/#storage-path-name

this bug is a photologue one which should use photo.url and not
photo.get_absolute_url here for instance:
http://code.google.com/p/django-photologue/source/browse/trunk/photologue/templates/photologue/photo_list.html

Let me know if it works with .url please.

Regards,
David

vinay

unread,
Sep 16, 2008, 12:11:11 AM9/16/08
to Django users
David,

I did play around with it little briefly today as you suggested. No
luck. Still get the same error.
I was digging around and it appears that a similar problem was
reported on Django photologue group. I will get more time later this
week to test out more features of S3 backend and also photologue.

Thanks

On Sep 15, 1:23 am, David Larlet <lar...@gmail.com> wrote:
> Le 15 sept. 08 à 07:16, David Zhou a écrit :
>
> > On Sep 15, 2008, at 1:01 AM, vinay wrote:
>
> >> File "/usr/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.
>
> > Sounds like you just need to define that method for the S3 backend.
> > It's falling back on the base method that spits out the exception.
>
> No, this is explicitly mentioned that you should not implement this  
> method for storages:http://docs.djangoproject.com/en/dev/ref/files/storage/#storage-path-...
>
> this bug is a photologue one which should use photo.url and not  
> photo.get_absolute_url here for instance:http://code.google.com/p/django-photologue/source/browse/trunk/photol...
Reply all
Reply to author
Forward
0 new messages