homeaboutvideotry it nowpricingdocs
Guide

Use Fileboy from Django: uploads, images and video

Install the official Python package, upload from a controller, and show resized images from a stored ID.

Why use a hosted file service from Django

Your Django app can keep files on its own disk, or in a bucket it has to configure, secure and resize for. With Fileboy the app sends the file once, gets an ID back and keeps only that ID. Images are resized by changing a URL, so there is no image processing in your app, and the same ID works from any language.

1. Install the package

pip install fileboy

You need a public key. Create a free app and copy it from the Keys page. Keep keys out of your code: read them from credentials or the environment.

2. Configure it once

settings.py
import os
import fileboy

fileboy.configure(
    public_key=os.environ["FILEBOY_PUBLIC_KEY"],
    private_key=os.environ.get("FILEBOY_PRIVATE_KEY"),  # optional
)

3. Upload and keep the ID

Pass the uploaded file through. The call returns the file's details, and the id is the only thing to store.

views.py
import fileboy
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect


@login_required
def upload_avatar(request):
    upload = request.FILES["avatar"]

    try:
        file = fileboy.client().upload_file(
            upload.file,
            name=upload.name,
            mime=upload.content_type,
        )
    except fileboy.FileboyError as error:
        return redirect(f"/profile/?error={error.code}")

    request.user.profile.avatar_fileboy_id = file.id
    request.user.profile.save(update_fields=["avatar_fileboy_id"])
    return redirect("/profile/")
models.py
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    avatar_fileboy_id = models.CharField(max_length=36, blank=True)

4. Show the image at the size you need

Build the URL from the stored ID. Asking for the size you display keeps pages light, and the original is never changed.

templatetags/avatars.py
import fileboy
from django import template

register = template.Library()


@register.simple_tag
def avatar_url(profile, size=96):
    if not profile.avatar_fileboy_id:
        return ""
    return fileboy.client().build_image_url(
        profile.avatar_fileboy_id,
        transforms=[
            {"type": "resize", "width": size * 2, "height": size * 2, "fit": "cover"},
            {"type": "format", "format": "webp"},
        ],
    )

Reading a file or image needs no key, so these URLs work in <img> tags, emails and anywhere else, unless the app requires signed URLs. Uploads are what your key authorises.

Checked against the current libraries in November 2026. Found something that no longer works? Tell us.

Go deeper

Still choosing a tool?

Fileboy is small on purpose. This comparison says where it fits and where another option is the better call.

Fileboy vs S3 + Lambda · All comparisons

Try it

The free plan needs no card and includes 1,000 files, so you can run every example above.

More guides: How to add image upload to a React app · Resize images on the fly with a URL · Stream video with HLS without running ffmpeg · Add captions and subtitles to a video · All guides

Add Fileboy to your next project

We built Fileboy to stop rebuilding file handling for every app. Create an app, paste your key and upload a file. The free plan needs no card.