django-bunny-storage


Namedjango-bunny-storage JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/willmeyers/django-bunny-storage
SummaryProvides Bunny.net file storage in Django.
upload_time2022-04-28 12:18:12
maintainerWill Meyers
docs_urlNone
authorWill Meyers
requires_python>=3.7
licenseMIT License
keywords django storage files
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-bunny-storage

Provides Bunny.net file storage in Django.

## Installation

`django-bunny-storage` requires Python >= 3.7.

```bash
pip install django-bunny-storage
```

## Configuration

Everything is configured in your `settings.py` file.

To use:

1. Add `django_bunny_storage` to your `INSTALLED_APPS`.

```python
INSTALLED_APPS = [
    ...
    'django_bunny_storage'
]
```

2. Add `BUNNY_USERNAME` and `BUNNY_PASSWORD` to your settings.

```python
BUNNY_USERNAME = 'myzone'

BUNNY_PASSWORD = 'myzone-random-password-string'

# Optional
BUNNY_REGION = 'de'
```

These settings correspond to your storage zone's *Username* and *Password* found under FTP & API Access in your Bunny.net Storage dashboard.

You must include `BUNNY_REGION` if the default region, **NY**, does not match the region you set yourself. 

3. Change your media url and default file storage backend.

```python
DEFAULT_FILE_STORAGE = 'django_bunny_storage.storage.BunnyStorage'

MEDIA_URL = 'https://myzone.b-cdn.net/' # The Pull Zone hostname.
```

The `MEDIA_URL` is set based on a linked Pull Zone that you setup in the Bunny.net dashboard.

#### In Templates

In order to display your media properly in templates, refer to Django's [docs on the MEDIA_URL attribute](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-MEDIA_URL) to ensure you're not getting 404s when trying to load media.

Whenever referencing media, do

```html
<img src="{{ MEDIA_URL }}{{ mymodel.file }}" />
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/willmeyers/django-bunny-storage",
    "name": "django-bunny-storage",
    "maintainer": "Will Meyers",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "will@willmeyers.net",
    "keywords": "django,storage,files",
    "author": "Will Meyers",
    "author_email": "will@willmeyers.net",
    "download_url": "https://files.pythonhosted.org/packages/7e/95/f1989847120d13c8161f620174cf5953a692c9318f84db42b804a602c320/django-bunny-storage-0.1.2.tar.gz",
    "platform": null,
    "description": "# django-bunny-storage\n\nProvides Bunny.net file storage in Django.\n\n## Installation\n\n`django-bunny-storage` requires Python >= 3.7.\n\n```bash\npip install django-bunny-storage\n```\n\n## Configuration\n\nEverything is configured in your `settings.py` file.\n\nTo use:\n\n1. Add `django_bunny_storage` to your `INSTALLED_APPS`.\n\n```python\nINSTALLED_APPS = [\n    ...\n    'django_bunny_storage'\n]\n```\n\n2. Add `BUNNY_USERNAME` and `BUNNY_PASSWORD` to your settings.\n\n```python\nBUNNY_USERNAME = 'myzone'\n\nBUNNY_PASSWORD = 'myzone-random-password-string'\n\n# Optional\nBUNNY_REGION = 'de'\n```\n\nThese settings correspond to your storage zone's *Username* and *Password* found under FTP & API Access in your Bunny.net Storage dashboard.\n\nYou must include `BUNNY_REGION` if the default region, **NY**, does not match the region you set yourself. \n\n3. Change your media url and default file storage backend.\n\n```python\nDEFAULT_FILE_STORAGE = 'django_bunny_storage.storage.BunnyStorage'\n\nMEDIA_URL = 'https://myzone.b-cdn.net/' # The Pull Zone hostname.\n```\n\nThe `MEDIA_URL` is set based on a linked Pull Zone that you setup in the Bunny.net dashboard.\n\n#### In Templates\n\nIn order to display your media properly in templates, refer to Django's [docs on the MEDIA_URL attribute](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-MEDIA_URL) to ensure you're not getting 404s when trying to load media.\n\nWhenever referencing media, do\n\n```html\n<img src=\"{{ MEDIA_URL }}{{ mymodel.file }}\" />\n```",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Provides Bunny.net file storage in Django.",
    "version": "0.1.2",
    "split_keywords": [
        "django",
        "storage",
        "files"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "8b86adc8fd7ba7c0ebf88bc51baa5cc0",
                "sha256": "d834aa4a5196ccbcda9675c8fb82a23d49f23744fdd63f7e3a877a1489997b44"
            },
            "downloads": -1,
            "filename": "django-bunny-storage-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8b86adc8fd7ba7c0ebf88bc51baa5cc0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3063,
            "upload_time": "2022-04-28T12:18:12",
            "upload_time_iso_8601": "2022-04-28T12:18:12.762892Z",
            "url": "https://files.pythonhosted.org/packages/7e/95/f1989847120d13c8161f620174cf5953a692c9318f84db42b804a602c320/django-bunny-storage-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-04-28 12:18:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "willmeyers",
    "github_project": "django-bunny-storage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-bunny-storage"
}
        
Elapsed time: 0.32341s