Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: This backend doesn't support absolute paths. #21

Open
oscarelotero opened this issue Dec 29, 2015 · 1 comment
Open

Comments

@oscarelotero
Copy link

Problems with django-storages and django-boto when run manage.py collectstatic


File "/Users/oscarelotero/Documents/Reingeniamos/Proyectos/AG-Corp/aplicacion/entorno/lib/python2.7/site-packages/audiofield/fields.py", line 259, in _set_audio_converted

    filename = self.generate_filename(instance, os.path.basename(getattr(instance, self.name).path))

File "/Users/oscarelotero/Documents/Reingeniamos/Proyectos/AG-Corp/aplicacion/entorno/lib/python2.7/site-packages/django/db/models/fields/files.py", line 64, in _get_path

    return self.storage.path(self.name)

File "/Users/oscarelotero/Documents/Reingeniamos/Proyectos/AG-Corp/aplicacion/entorno/lib/python2.7/site-packages/django/core/files/storage.py", line 114, in path

     raise NotImplementedError("This backend doesn't support absolute paths.")

@michaelappuhn
Copy link

michaelappuhn commented May 1, 2019

Seems like the solution can be drawn from this StackOverflow comment:

I have got it working... not perfect but it works. I needed to rewrite part of the django-audiofield fields.py. Specifically the def _rename_audio and def _set_audio_converted as they both included the path method which doesn't work if you are not serving your static files from local.

I just commented these methods out for now, which is obviously a bad long-term move. The File Storage API is just outside of my wheelhouse, otherwise I'd make a PR :-)

This StackOverflow comment - found via this blog article describes how the File storage API should be used instead of absolute paths when dealing with remote storage.

I think that calling the path property of the FileSystemStorage class, and then using absolute URLs for renaming files is what's flagging this error:

For storage systems that aren’t accessible from the local filesystem, this will raise NotImplementedError instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants