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

You can limit the maximum number of workers using -w:

./manage.py s3manifestcollectstatic -w 4

Tested with:

  • Python 3.9, Django 3.2, django-storages 1.11
  • Python 3.11, Django 4.2, django-storages 1.13

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.3.2.tar.gz (3.6 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.3.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: s3manifestcollectstatic-0.3.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for s3manifestcollectstatic-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c742b07e36261e898db22bf031925053d7b0bfa17084783190e7fb6408cea59a
MD5 51f4e4c02f38ef00a38993ea54c750d0
BLAKE2b-256 bbc58291f5c1fd7fce0a7f9de0ec92663de1af58b580df69937e4e8021462010

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for s3manifestcollectstatic-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3850b5f226eddc949daa38a07fcede657e521afa2192e67fedfab08ab5a846e
MD5 e74f113edecc99468eac215eebfe4d58
BLAKE2b-256 4e81c09d2c97191f699e50d5970a7adc6509d704bf0add095e86c5947f5cdaed

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