Skip to main content

Use AWS S3 with private documents in Wagtail.

Project description

https://github.com/torchbox/wagtail-storages/raw/master/logo.png

wagtail-storages

https://img.shields.io/pypi/v/wagtail-storages.svg https://img.shields.io/pypi/dm/wagtail-storages.svg https://travis-ci.org/torchbox/wagtail-storages.svg?branch=master

This package fills the missing gap in using AWS S3 together with Wagtail. This package will be useful if you want to:

  • Use AWS S3 bucket for hosting Wagtail documents.

  • Put the bucket behind the CDN so that the bucket is not called directly each time.

  • Allow editors to use privacy controls on documents, whilst using CDN.

  • Avoid time-outs because of downloads being proxied through Wagtail views.

    Note: you cannot use the document redirect view if you want your documents to be truly private.

What does it do?

The package is a collection of signal handlers and Wagtail hooks.

  • Sets per-object ACLs on S3 whenever privacy settings change on a Wagtail document.

  • Replaces the current document view with a redirect. Either to a signed S3 bucket URL for private documents or public custom domain URL for public ones.

  • Purges CDN for documents that have changed.

Requirements

  • django-storages with the S3Boto3Storage storage backend configured in a Wagtail project.

  • CDN supported by Wagtail front-end cache invalidator.

Management commands

django-admin fix_document_acls

The package provider a management command that sets all the documents’ ACLs according to the their collection permissions. This must be called if there had been documents in a bucket before the package was used to make sure the ACLs in the bucket are correct.

Settings

WAGTAIL_STORAGES_DOCUMENTS_FRONTENDCACHE

Using the same format as Wagtail’s WAGTAILFRONTENDCACHE setting, but to be only used by the wagtail-storages to purge the documents. If not set, the purge won’t happen. Read more on how to format it in the Wagtail docs, e.g.

WAGTAIL_STORAGES_DOCUMENTS_FRONTENDCACHE = {
    'cloudfront': {
        'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
        'DISTRIBUTION_ID': 'your-distribution-id',
     },
}

WAGTAIL_STORAGES_DOCUMENT_HOOK_ORDER

Set a custom order for the document hook order. It’s set to 100 by default. It’s important that it runs after any of your hooks since it returns a response, e.g.

WAGTAIL_STORAGES_DOCUMENT_HOOK_ORDER = 900

Project details


Download files

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

Source Distribution

wagtail-storages-0.0.5.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

wagtail_storages-0.0.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file wagtail-storages-0.0.5.tar.gz.

File metadata

  • Download URL: wagtail-storages-0.0.5.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for wagtail-storages-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c4db24256a99341ff7ac9e9e3ed8071bba4a3c14feb8c4226cc66bd59e775d90
MD5 c24a9f345649ef0fd4c1bfe65de1ea13
BLAKE2b-256 7c67f87f7c88a5e4fefd25858a0a56bf4c153175d983a7427e9efae131fcf65f

See more details on using hashes here.

Provenance

File details

Details for the file wagtail_storages-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: wagtail_storages-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for wagtail_storages-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2b6111a62d095708672f2529b28f66b90b7987cb129388e05640fb3996bc150d
MD5 06363c9a44c7834630a318e540d33a24
BLAKE2b-256 6bc0c21bdc3bb850bbb14b0ea857b3372e28c2db75e6a516a3bdbe149fd7d95e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page