django-bunny
A bunny.net storage for Django. It was created as a replacement for django-bunny-storage.
Installation
You can install the library using pip:
pip install django-bunny
Configuration
First, add django_bunny to your INSTALLED_APPS:
INSTALLED_APPS = [
...,
"django_bunny",
...
]
Now, create the following variables inside your settings.py file. These are required if you are using Django < 4.2. Otherwise, you can use OPTIONS in the STORAGES setting.
# These can be found in your storage's dashboard under `FTP & API Access`
BUNNY_USERNAME = "my-storage-name"
BUNNY_PASSWORD = "my-storage-password"
# This is the storage region's code. E.g. Los Angeles is `la`, Singapore is
# `sg`, etc. The default is `ny` (New York).
BUNNY_REGION = "my-storage-region"
# Optional. For example, `https://myzone.b-cdn.net/`. `MEDIA_URL` will be used
# if this is not set.
BUNNY_HOSTNAME = "my-pullzone-hostname"
# Optional. For example, `static/`. If not set, files will be stored in the
# storage's root dir.
BUNNY_BASE_DIR = "my-storage-base-dir-where-i-want-my-files-stored/"
Finally, depending on which version of Django you are using you'll need to create one of these variables:
# Django < 4.2
DEFAULT_FILE_STORAGE = 'django_bunny.storage.BunnyStorage'
# Django >= 4.2. Set `BunnyStorage` where you want to use bunny.net's storage.
{
"default": {
"BACKEND": "django_bunny.storage.BunnyStorage",
# Add this if you did not create the BUNNY_* settings before. They are
# the same as BUNNY_* variables.
"OPTIONS": {
"username": "my-storage-name",
"password": "my-storage-password",
# Optional. Defaults to `ny`
"region": "my-storage-region",
# Optional. `MEDIA_URL` will be used if it is not set
"hostname": "my-pullzone-hostname",
# Optional. `BUNNY_BASE_DIR` will be used if it is not set.
"base_dir": "my-storage-base-dir-where-i-want-my-files-stored/"
}
},
}
In Django >= 4.2 you can set different credentials for the different storages. This allows you to, for example, use a separate storage for static files.
Using in templates
In templates, you can use {{ instance.file.url }} directly. For example:
<img src="{{ instance.file.url }}" />
Metadata
Release files for django-bunny 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_bunny-1.1.6.tar.gz | 4.4 kB | Without provenance | Details for django_bunny-1.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_bunny-1.1.6-py3-none-any.whl | Python 3 | none | any | Details for django_bunny-1.1.6-py3-none-any.whl |
Total release size: 9.2 kB
Release files / django_bunny-1.1.6.tar.gz
| Download URL | django_bunny-1.1.6.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
753b29a8f56ab7cf985487a84e23047443fb450d241e7f11615ec963d83fd84a
|
|
BLAKE2b-256 checksum How to use checksums |
24d38190a8c7cf59a9dc5011898e3fc56b5c2c221d9912d2fff0508155b79336
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.5 Windows/10
|
Release files / django_bunny-1.1.6-py3-none-any.whl
| Download URL | django_bunny-1.1.6-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccfd02286b7726284a94ee5991dfd116e040af703c5f578cad6be519a7e6b43b
|
|
BLAKE2b-256 checksum How to use checksums |
b611d4a896233bd792ef26349f03ee828acae43c9256aa8bd63b28d918167492
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.5 Windows/10
|
Security for django-bunny 1.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.