If you do not wish to use a django cache, you can use a sqlite database on disk for caching, or use a non-thread-safe in-memory implementation. It is not recommended configure accountInfo with the default django cache, as the clear() method may be called during the backblaze lifecycle. This is to leverage django's thread-safe cache implementations, and if you are using a database cache table or memcached, (rather than LocMemCache) your cache can be shared by the multiple django processes that typically serve requests. Because these are network calls, and relatively expensive in comparison to a file-based storage, and because data is unlikely to change frequently, there is some caching done by this library.īy default, the account information ( accountInfo) configuration of the settings uses a cache by the name of django-backblaze-b2 which you must have in your CACHES section of your settings.py. To retrieve file metadata ("file info" as the b2 sdk names it), this library has to authorize and request data from b2 servers, even for just resolving the url for a file. Add the urls to your urlpatterns in the root urls.py:.Add django_backblaze_b2 to your INSTALLED_APPS.FileField ( upload_to = "uploads", storage = BackblazeB2Storage ) Public/Logged-In/Private storage from django_backblaze_b2 import BackblazeB2Storage class MyModel ( models. Theoretically you may now refer to the base storage class as a storage class (see the sample app for some usage: you can run with make run-sample-proj although you might want to configure the SECONDS_TO_RUN_APP variable in settings.env to be 0 for unlimited to try things out)Į.g.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |