Skip to main content

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:

  1. Add bunnycdn_storage to your INSTALLED_APPS in settings.py file
INSTALLED_APPS = [
    ...
    'bunnycdn_storage',
    ...
]
  1. Add BUNNY_USERNAME and BUNNY_PASSWORD to 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.

  1. Change the MEDIA_URL in settings.py file.
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.

  1. Change the default file storage in settings.py file.
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.

  1. Add django.template.context_processors.media in the context_processors option of TEMPLATES in settings.py file.
...
'django.template.context_processors.media',
...

To load media properly without getting 404, use:

<img src="{{ MEDIA_URL }}{{ your_model.file }}" />

That's it.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-bunnycdn-storage-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file python-bunnycdn-storage-0.1.1.tar.gz.

File metadata

  • Download URL: python-bunnycdn-storage-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for python-bunnycdn-storage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b81b2c8fafa2aaec747ec065fdfacd6151b470f680a4a6e6f164c483d057d206
MD5 3eb4492f62f07048c4d04c81606e8b38
BLAKE2b-256 1b617d4b0d92bcace187fdf10c2a55b55c7f63c4e3d77b3e7ee46a80678c9da0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page