python-bunnycdn-storage
This package provides Bunny.net file storage for Django. An improved and working version. Thanks to Will Meyers' django-bunny-storage.
Package Installation
python-bunnycdn-storage requires Python >= 3.7 and Django >= 3.0
pip install python-bunnycdn-storage
Package Configuration
Details to configure Bunny.net Storage.
To use:
- Add
bunnycdn_storageto yourINSTALLED_APPSinsettings.pyfile
INSTALLED_APPS = [
...
'bunnycdn_storage',
...
]
- Add
BUNNY_USERNAMEandBUNNY_PASSWORDto your settings.
BUNNY_USERNAME = 'your_bunny_username'
BUNNY_PASSWORD = 'your_bunny_password'
# This is optional
BUNNY_REGION = 'de'
The above settings must match the storage zone and password of your Bunny.net account. To find Storage zone Username and Password, open the FTP & API Access under Storage in your Bunny.net dashboard.
Note: You must include BUNNY_REGION if you choose another region other than the default Falkenstein region, DE.
- Change the MEDIA_URL in
settings.pyfile.
MEDIA_URL = 'https://your_zone.b-cdn.net/' # This is your Pull Zone linked hostname
The MEDIA_URL corresponds to the linked Pull Zone you setup in the Bunny.net dashboard.
- Change the default file storage in
settings.pyfile.
DEFAULT_FILE_STORAGE = 'bunnycdn_storage.storage.BunnyCDNStorage'
Displaying Media in Template
This setup uses media url context processor to serve media. Refer to the documentation in Django for more details.
- Add
django.template.context_processors.mediain thecontext_processorsoption of TEMPLATES insettings.pyfile.
...
'django.template.context_processors.media',
...
To load media properly without getting 404, use:
<img src="{{ MEDIA_URL }}{{ your_model.file }}" />
That's it.
Metadata
Release files for python-bunnycdn-storage 0.1.1
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 |
|---|---|---|---|---|
| python-bunnycdn-storage-0.1.1.tar.gz | 3.5 kB | Without provenance | Details for python-bunnycdn-storage-0.1.1.tar.gz |
Release files / python-bunnycdn-storage-0.1.1.tar.gz
| Download URL | python-bunnycdn-storage-0.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b81b2c8fafa2aaec747ec065fdfacd6151b470f680a4a6e6f164c483d057d206
|
|
BLAKE2b-256 checksum How to use checksums |
1b617d4b0d92bcace187fdf10c2a55b55c7f63c4e3d77b3e7ee46a80678c9da0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.0
|
Security for python-bunnycdn-storage 0.1.1
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.