royendgel / django-backblazeb2-storage

Django BackBlaze B2 Storage
22 stars 18 forks source link

False statement in the docs about INSTALLED_APPS #11

Open moorchegue opened 7 years ago

moorchegue commented 7 years ago

if you are making alot of api calls I recommend you to use the b2_storage.authorise, it stores the seconds in your database and reuses the authorisation_token for other calls. for this you need to include 'b2_storage.authorise', in your INSTALLED_APPS

There's no such thing as b2_storage.authorise in the code, so adding it to INSTALLED_APPS causes an Exception. Was it planned but not implemented? Was it implemented differently but not updated in the docs?

royendgel commented 7 years ago

Hi I will into this in the weekend.

royendgel commented 7 years ago

Hi @moorchegue it was planned to go into the code, but never happened, I will leave it as is and implement it. did you do something about it ?

moorchegue commented 7 years ago

No, not really, I'm not even sure how to implement it, gotta read Backblaze docs…

moorchegue commented 7 years ago

@royendgel, check out this another approach: https://github.com/moorchegue/django-backblazeb2-storage/commit/b212588ba6ca0ba3e0c81115307815bbfb18bbcb

I took out authorization request from the constructor to speed up application start and made it sort of lazyish. It doesn't really reuse a token for multiple instances as initially planned, I guess. Should I update the docs and make a PR? Not sure if you'd like this solution or not, so asking first.

pycebs commented 6 years ago

@moorchegue I tried to contact you via your fork, but I cannot create a new "Issue". Have you implemented this in your fork yet? I saw you did a lot of work/refactoring the last few weeks. Is your fork "safe to use"? I want to share files in a private bucket, so the URL cannot be shared (no authentication) publicly but only through my website. The official docs say this:

An account authorization token, obtained from b2_authorize_account. This is required if the bucket containing the file is not public. It is optional for buckets that are public.

https://www.backblaze.com/b2/docs/b2_download_file_by_id.html

Is this supported by the plugin?

moorchegue commented 6 years ago

I have. However it's been a while, so I don't remember clearly and I probably haven't checked that scenario, sorry. There is a chance private buckets just don't work. I'm using the fork in production for several months now with public buckets only. It's stable enough, but every once in a while Backblaze service itself gets unstable and I add more and more defensive code.

I'll need private buckets as well eventually and if it's not sorted out by then I'll get back to you with a PR.

bartoszhernas commented 5 years ago

This makes this package really slow. We've fixed it by adjusting authorization code and returning it to Django differently:

https://github.com/whatsahoy/django-backblazeb2-storage