Skip to main content

BellHop

BellHop is a simple way to upload files from Django applications. It is inspired by the CarrierWave gem for Ruby. Currently, only AWS is supported.

Installation

Install from PyPI

pip install bellhop

Once done, add the BELLHOP settings in your settings.py file:

BELLHOP = {
    "STORAGE": "aws",
    "AWS_ACCESS_KEY_ID": os.environ["AWS_ACCESS_KEY_ID"],
    "AWS_SECRET_ACCESS_KEY": os.environ["AWS_SECRET_ACCESS_KEY"],
    "S3_BUCKET": os.environ["S3_BUCKET"],
    "S3_REGION": os.environ["S3_REGION"],
}

Example

Define a model in models.py which would store a file. The model should contain one CharField which we would use to reference the file.

In this example, the file would be stored using the field file of model Document.

class Document(models.Model):
    file = models.CharField(max_length=255)

Create a file uploaders.py in your app. We would register the model with an uploader, where we define the field which references the file as uploadable, which is file in our case:

from testapp.models import Document

from bellhop import bellhop, BaseUploader


class DocumentUploader(BaseUploader):
    uploadable = "file"


bellhop.register(Document, DocumentUploader)

Now, you can easily upload a file as:

file = open('/path/to/file')
document = Document.objects.create(file=file)

# Access the url of the file
document.file_url

Metadata

Release files for bellhop 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bellhop 0.0.1
File Size Uploaded Provenance
bellhop-0.0.1.tar.gz 12.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bellhop 0.0.1
File Interpreter ABI Platform
bellhop-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / bellhop-0.0.1.tar.gz

Download URL bellhop-0.0.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
33a1afe9c6d5c8b3dc73cf32375114dcb80f9b882f364ba065408e143b58141d
BLAKE2b-256 checksum
How to use checksums
2aa1513db75ebe1f67dded87324d7300aa9cae264dd084d8e83cd3ae08d60ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / bellhop-0.0.1-py3-none-any.whl

Download URL bellhop-0.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88e0a709f5e819bc5a8c66bbc7d1b2ca133d8444e809b13411b17c6bfaf6cae6
BLAKE2b-256 checksum
How to use checksums
98a1d4834e29f2119afeb5e18742be3091283bf387b8a3a4f864cf99f20f8939
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Security for bellhop 0.0.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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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