Skip to main content

Optimized collectstatic for S3ManifestStaticStorage

Project description

s3manifestcollectstatic

Optimized collectstatic for S3ManifestStaticStorage

Installation

  1. Install the package
pip install s3manifestcollectstatic
  1. Add s3manifestcollectstatic to INSTALLED_APPS

Description

collectstatic can take a long time. When used with storages.backends.s3boto3.S3ManifestStaticStorage, collectstatic uploads the files twice, once without the hash at the end of the file name, and once with the hash. Also, it doesn't use multiple threads to upload to s3.

s3manifestcollectstatic uploads the files only once, uses threads to speed things up, and doesn't upload the files that are already on S3.

collectstatic: (Around 20 minutes)

$ time ./manage.py collectstatic --noinput

604 static files copied, 646 post-processed.
./manage.py collectstatic --noinput  29,94s user 2,27s system 2% cpu 20:25,06 total

s3manifestcollectstatic: (Around 30 seconds)

$ time ./manage.py s3manifestcollectstatic

604 static files copied to '/tmp/tmpbw0q_5lq', 646 post-processed.
Start the upload of 604 files
Uploading the manifest
./manage.py s3manifestcollectstatic  10,95s user 1,92s system 49% cpu 26,269 total

If you want to reupload the files use -f:

./manage.py s3manifestcollectstatic -f

Tested with Python 3.9, Django 3.2, django-storages 1.11

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

s3manifestcollectstatic-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3manifestcollectstatic-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file s3manifestcollectstatic-0.1.0.tar.gz.

File metadata

  • Download URL: s3manifestcollectstatic-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.9.4 Linux/5.8.0-48-generic

File hashes

Hashes for s3manifestcollectstatic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8cd4748798f4edb0689494c9c21d6ed8440ad771c1d40b3cab123e7c73ebc1f
MD5 d85094426a75bcd66e8eea0c4097d5de
BLAKE2b-256 92c3c9598dff187986bb5e48a001c49d369f7fa51d26c7751a74b67325277949

See more details on using hashes here.

File details

Details for the file s3manifestcollectstatic-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for s3manifestcollectstatic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 094c301bd3ed97a2c5da8f2a3e095a957db67ddeee34553195368a08daccd5c6
MD5 7f567b1cec0b7768333f6e6d5e938c99
BLAKE2b-256 6eaa863994b7307ab97d5bd7ae480a61a8cc7ecfdedd96b6a53b34f03db58972

See more details on using hashes here.

Supported by

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