4

I have problem with using Photologue app on heroku with S3 as a storage for media and static files, Django 1.5.

The problem is that whenever I try to add e.g. a photo size in django admin I get: NotImplementedError

Exception Value:    
This backend doesn't support absolute paths.

the same goes for trying to configure photologue with manage.py plinit.

The problem seems to be that photologue tries to use os.path method in several places like (traceback):

/app/.heroku/python/lib/python2.7/site-packages/photologue/models.py in _get_SIZE_filename
    return smart_str(os.path.join(self.cache_path(), 

Is there any way to use django-photologue with remote storage, Amazon S3 in particular?

Pawel Ceranka
  • 441
  • 1
  • 4
  • 7

2 Answers2

2

This fork of django-photologue works with s3 perfectly. There are some others improvements you may love also.

Thanks to Marcos Daniel Petry, the author of this fork. Saved me from a lot of problems.

Daniel Naab
  • 22,690
  • 8
  • 54
  • 55
Pol
  • 24,517
  • 28
  • 74
  • 95
  • running `pip freeze > requirements.txt` gave me a reference to a petry fork of photologue that Heroku is unable to install. If you have this issue, replace that pip install reference (`django-photologue==2.8dev0`) with: `git+git://github.com/petry/django-photologue.git` – ecoe Apr 14 '14 at 23:04
0

The conflict was in the s3boto storage class the path method was not implemented. As per the Django documentation, for non local storage you should not implement this method. The only way to solve this as a suggestion was to go ahead and implement this method in the django-photologue code and modify storages.backends.s3boto and add the path method.

def url(self, name):
    ...

def path(self, name):
    return None

https://bitbucket.org/david/django-storages/src/tip/storages/backends/s3boto.py

catherine
  • 22,492
  • 12
  • 61
  • 85
  • @donkeyboy72 Based on what I read, your media files must handle in other server like Amazon S3. Reducing the burden of your site. But in my case I never use this, maybe in the future – catherine Apr 13 '13 at 14:04
  • Right. Thanks for the answer @catherine, it is quite similar to what I have found in the interwebs. I'm afraid that I can't do much with it though:) I'm not really sure how I should "implement this method in django-photologue". I'm quite new to Django. – Pawel Ceranka Apr 14 '13 at 18:06