python-bunnycdn-storage


Namepython-bunnycdn-storage JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/exceptionalvic/python-bunnycdn-storage
SummaryThis package provides Bunny.net file storage for Django.
upload_time2023-08-23 00:43:36
maintainerVictor Igbokwe
docs_urlNone
authorVictor Igbokwe
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.
            # python-bunnycdn-storage

This package provides Bunny.net file storage for Django.
An improved and working version. Thanks to Will Meyers' [django-bunny-storage](https://github.com/willmeyers/django-bunny-storage).

## Package Installation

`python-bunnycdn-storage` requires Python >= 3.7 and Django >= 3.0

```bash
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

```python
INSTALLED_APPS = [
    ...
    'bunnycdn_storage',
    ...
]
```

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

```python
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**. 

3. Change the MEDIA_URL in `settings.py` file.

```python
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.

4. Change the default file storage in `settings.py` file.

```python
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](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-MEDIA_URL) for more details.

5. Add `django.template.context_processors.media` in the `context_processors` option of TEMPLATES in `settings.py` file.

```python
...
'django.template.context_processors.media',
...
```

To load media properly without getting 404, use:

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

That's it.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/exceptionalvic/python-bunnycdn-storage",
    "name": "python-bunnycdn-storage",
    "maintainer": "Victor Igbokwe",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "victor@victorigbokwe.site",
    "keywords": "django,storage,files",
    "author": "Victor Igbokwe",
    "author_email": "victor@victorigbokwe.site",
    "download_url": "https://files.pythonhosted.org/packages/1b/61/7d4b0d92bcace187fdf10c2a55b55c7f63c4e3d77b3e7ee46a80678c9da0/python-bunnycdn-storage-0.1.1.tar.gz",
    "platform": null,
    "description": "# python-bunnycdn-storage\n\nThis package provides Bunny.net file storage for Django.\nAn improved and working version. Thanks to Will Meyers' [django-bunny-storage](https://github.com/willmeyers/django-bunny-storage).\n\n## Package Installation\n\n`python-bunnycdn-storage` requires Python >= 3.7 and Django >= 3.0\n\n```bash\npip install python-bunnycdn-storage\n```\n\n## Package Configuration\n\nDetails to configure Bunny.net Storage.\n\nTo use:\n\n1. Add `bunnycdn_storage` to your `INSTALLED_APPS` in `settings.py` file\n\n```python\nINSTALLED_APPS = [\n    ...\n    'bunnycdn_storage',\n    ...\n]\n```\n\n2. Add `BUNNY_USERNAME` and `BUNNY_PASSWORD` to your settings.\n\n```python\nBUNNY_USERNAME = 'your_bunny_username'\n\nBUNNY_PASSWORD = 'your_bunny_password'\n\n# This is optional\nBUNNY_REGION = 'de'\n```\n\nThe 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.\n\nNote: You must include `BUNNY_REGION` if you choose another region other than the default Falkenstein region, **DE**. \n\n3. Change the MEDIA_URL in `settings.py` file.\n\n```python\nMEDIA_URL = 'https://your_zone.b-cdn.net/' # This is your Pull Zone linked hostname\n```\n\nThe `MEDIA_URL` corresponds to the linked Pull Zone you setup in the Bunny.net dashboard.\n\n4. Change the default file storage in `settings.py` file.\n\n```python\nDEFAULT_FILE_STORAGE = 'bunnycdn_storage.storage.BunnyCDNStorage'\n```\n\n#### Displaying Media in Template\n\nThis setup uses media url context processor to serve media. Refer to the documentation in [Django](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-MEDIA_URL) for more details.\n\n5. Add `django.template.context_processors.media` in the `context_processors` option of TEMPLATES in `settings.py` file.\n\n```python\n...\n'django.template.context_processors.media',\n...\n```\n\nTo load media properly without getting 404, use:\n\n```html\n<img src=\"{{ MEDIA_URL }}{{ your_model.file }}\" />\n```\n\nThat's it.",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "This package provides Bunny.net file storage for Django.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/exceptionalvic/python-bunnycdn-storage"
    },
    "split_keywords": [
        "django",
        "storage",
        "files"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b617d4b0d92bcace187fdf10c2a55b55c7f63c4e3d77b3e7ee46a80678c9da0",
                "md5": "3eb4492f62f07048c4d04c81606e8b38",
                "sha256": "b81b2c8fafa2aaec747ec065fdfacd6151b470f680a4a6e6f164c483d057d206"
            },
            "downloads": -1,
            "filename": "python-bunnycdn-storage-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3eb4492f62f07048c4d04c81606e8b38",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3521,
            "upload_time": "2023-08-23T00:43:36",
            "upload_time_iso_8601": "2023-08-23T00:43:36.962186Z",
            "url": "https://files.pythonhosted.org/packages/1b/61/7d4b0d92bcace187fdf10c2a55b55c7f63c4e3d77b3e7ee46a80678c9da0/python-bunnycdn-storage-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-23 00:43:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "exceptionalvic",
    "github_project": "python-bunnycdn-storage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-bunnycdn-storage"
}
        
Elapsed time: 0.16368s