-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
django-assets should support Django's storage backends #62
Comments
Since support for this would probably have to be added to webassets core anyway, using PyFilesystem might be an option. |
+1 If you are not already working on this I could potentially give it a go. Let me know if you are interested. |
Hey Niels, missed your comment. I'm not currently working on it. This isn't that hard a thing to implement in general, but the devil is in the details. Some thoughts.
|
Thanks for getting back to me. I'm not using webassets for my project anymore, so I'm not motivated to work on it currently. Sorry. |
Having remote options would be great for deploying Python applications to hosts like Heroku, that allow applications to write to /tmp but don't guarantee that they will still be available on the next request. Being able to have bundle outputs stored on S3 to be accessed through Cloudfront or some other CDN that would be awesome. |
One other alternative for consideration. After browsing through the code I think this would be a fairly quick implementation.
Under this setup, you would just configure your storage backend for staticfiles, and |
Note that bad an idea, Michael. It's not exactly "nice" having to use yet another directory for the webassets output, but it would be easy. It might even be already possible to configure it along those lines: ASSETS_ROOT should work for a custom output directory (staticfiles would still be used for source files). Do people push files to S3 even during development? |
Thinking about it a bit more, I think we could just use I personally don't push to S3 during development, but I do in our staging environment. |
I just got back to this and I found a solution that's working great for me. I have a dummy app First running For me just having a setting to enable this and some documentation similar to what I described above completely solves the issue for me. |
Just an update that I realized using |
I'm not currently developing under Django, but I'd really have webassets modified to allow using PyFilesystem to access storage. I suppose the main modification would to abstract filesystem access routine by replacing os.*, FileHunk and open() built-ins with an extensible interface. I'm willing to help. Would you consider evaluating a patch? Any advice? |
I'm also having a problem with this. Django-assets keeps looking for assets in Wouldn't it suffice then to change the |
IMO, you still want |
I prefer to not have any static files on my heroku slugs, but I could live with a small assets folder for this. I understand this might not be ideal for everyone. Making the storage backend configurable via If only that would solve my problem. Even though I have |
I haven't gotten a solution I'm happy with for Heroku yet either. Are you using the |
@Koed00 A traceback would be illuminating. ASSETS_AUTO_BUILD should indeed disable any file system access. Obviously that means that it needs to be able to construct the url to the files with checking any files, but that is only a problem if you want the url to contain a version. The error you should be seeing in such a case is BundleError("Cannot find version of ...") |
I gisted a stacktrace https://gist.github.com/Koed00/6842666 I gather the following happens; Webassets will look for the version number in the I'll try |
That would make it worse :) You need to either
It would probably be useful though if webassets could get the version from the files on S3 by itself initially (and then maybe store them somewhere for speed), so this ticket does relate. |
@miracle2k works now without the versioning. Manifest file didn't work, cause it looks for it on the local filesystem. This would mean I'd have to commit the manifest to git and manually upload the compiled bundles. This is far from ideal with the dozen bundles I've already got. I'll do without versioning for now. A solution I've seen in other django packages is to allow the user to select a different storage handler for the django-assets part via a setting. This would probably make things work, as long as Auto Build is off , so there's no webassets code used. I'm willing to give it a go, just be aware that I've only been using Python and Django for about 3 months ;) |
Is this still in the pipeline? And does it extend to non-django projects? I'm using webassets standalone and can use this! |
This would allow writing output files directly to S3, for example.
The text was updated successfully, but these errors were encountered: