Registry / aws / collectfast

collectfast

JSON →
library2.2.0pypypiunverified

Collectfast dramatically speeds up Django's `collectstatic` command when using cloud storage by only uploading static files that have changed. It leverages MD5 hashes (ETags) or modification times to determine if a file needs to be re-uploaded. The current version is 2.2.0, with a release cadence of a few times per year, focusing on compatibility and performance improvements.

pip install collectfast
INSTALL
IMPORT
SIG · COLLECTFAST
C
collectfast
awspythonv2.2.0
Install
3.6s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.6s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Strategy
from collectfast.strategies.base import Strategy
from collectfast.strategies.base import Strategy

To quickly set up `collectfast`, add it to your `INSTALLED_APPS` and configure the necessary settings in your Django `settings.py`. Ensure `COLLECTFAST_ENABLED` is `True` and, crucially, set `COLLECTFAST_STRATEGY` to match your static files storage backend. This example shows configuration for AWS S3 using `django-storages`.

import os # settings.py # Add collectfast to your INSTALLED_APPS INSTALLED_APPS = [ # ... other apps 'collectfast', 'storages', # if using django-storages ] # Enable Collectfast COLLECTFAST_ENABLED = True # Explicitly set the strategy (required since collectfast 2.0.0) # Choose the strategy that matches your STATICFILES_STORAGE backend # For AWS S3 with django-storages s3boto3 backend: COLLECTFAST_STRATEGY = 'collectfast.strategies.aws.S3Strategy' # Configure your STATICFILES_STORAGE (example for AWS S3 with django-storages) AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', 'your_access_key') AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', 'your_secret_key') AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME', 'your-bucket-name') AWS_S3_REGION_NAME = os.environ.get('AWS_S3_REGION_NAME', 'us-east-1') AWS_S3_SIGNATURE_VERSION = 's3v4' AWS_S3_FILE_OVERWRITE = False AWS_DEFAULT_ACL = None # Or 'public-read' if files should be publicly accessible STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' STATIC_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/" # Define STATIC_ROOT for local collectstatic (even if collectfast bypasses it for cloud storage) STATIC_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'staticfiles')
Debug
Known issues
breaking`collectfast` 2.0.0 dropped support for Python 3.5 and Django 1.11. It also removed the `boto` strategy (`collectfast.strategies.boto.BotoStrategy`), requiring migration to `boto3` strategies for S3.
fix
Upgrade Python to 3.6+ and Django to 2.0+. If using S3, ensure `django-storages` is configured with `S3Boto3Storage` and `COLLECTFAST_STRATEGY` is set to `collectfast.strategies.aws.S3Strategy`.
affects: >=2.0.0
breakingStarting with `collectfast` 2.0.0, the `COLLECTFAST_STRATEGY` setting must be explicitly defined in your Django `settings.py` as automatic strategy guessing was removed.
fix
Add `COLLECTFAST_STRATEGY = 'collectfast.strategies.aws.S3Strategy'` (or other relevant strategy, e.g., `collectfast.strategies.filesystem.FileSystemStrategy`) to your `settings.py`.
affects: >=2.0.0
deprecated`collectfast.strategies.boto.BotoStrategy` was deprecated in version 1.3.0 and completely removed in 2.0.0. Using this strategy will result in errors.
fix
Migrate to `collectfast.strategies.aws.S3Strategy` (for `boto3`) and ensure `django-storages` is configured with `S3Boto3Storage`.
affects: 1.3.0 - 2.x
gotchaPrior to `collectfast` 2.2.0, there was a bug where gzip compression level for static files was inconsistent with S3's default handling, potentially causing issues with served content if not explicitly managed.
fix
Upgrade `collectfast` to 2.2.0 or later to ensure consistent gzip compression levels for S3.
affects: <2.2.0
Upgrade
Version history
2.2.0latest on PyPI · released Jun 5, 2020
Audit
Dependencies
DjangorequiredCollectfast is a Django app for speeding up static file collection.
django-storagesoptionalRequired for most cloud storage backends (e.g., S3, GCS) which collectfast aims to optimize.
boto3optionalRequired by django-storages when using AWS S3 storage backend.
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources
collectfast — pip install collectfast · libregistry