Skip to main content

A django widget library for securely uploading files directly to S3 (or MinIO).

Project description


PyPI version PyPI - Python Version PyPI - Django Version

django-s3-file-field is a Django widget library for uploading files directly to S3 (or MinIO) through the browser. django-s3-file-field heavily depends on the django-storages package.


Ensure you've configured your Django installation to use django-storages for S3 access:

Install the django-s3-file-field package:

pip install django-s3-file-field

Add s3_file_field to your INSTALLED_APPS:


Add the required settings:

S3FF_UPLOAD_STS_ARN = '' # see STS Role section below (not required for minio)

Add the appropriate routes to

urlpatterns = [
    path('api/s3-upload/', include('s3_file_field.urls')),


from s3_file_field import S3FileField

class Car(db.Model):
    owners_manual = S3FileField()

Running checks

django-s3-file-field can detect common misconfigurations using Django's built in System check framework. To confirm your configuration is correct, run:

./ check

Advanced Topics

Advanced configuration

Key Default Description
S3FF_UPLOAD_PREFIX none Prefix where files should be stored
S3FF_API_BASE_URL /api/s3-upload API prefix where the server urls are hosted

STS configuration

CORS configuration

This is a minimal function CORS configuration for an S3 bucket to be compatible with django-s3-file-field:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">

Note: These are insecure defaults, the allowed origin and headers should not be a wildcard but instead modified for your specific deployment(s).

MinIO support

MinIO support depends on the django-minio-storage config (see, following settings are used

Security considerations

Integrating with forms

note on


django-s3-file-field sends out two signals when its REST api is called:

s3_file_field_upload_prepare(name: str, object_key: str)
s3_file_field_upload_finalize(name: str, object_key: str, status: string)

API Reference

Project details

Download files

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

Files for django-s3-file-field, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size django_s3_file_field-0.0.5-py2.py3-none-any.whl (107.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-s3-file-field-0.0.5.tar.gz (107.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page