Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dreipol/django-collectfaster
Parallel file copying for Django's collectstatic.
https://github.com/dreipol/django-collectfaster
collectstatic django parallelization performance
Last synced: 7 days ago
JSON representation
Parallel file copying for Django's collectstatic.
- Host: GitHub
- URL: https://github.com/dreipol/django-collectfaster
- Owner: dreipol
- License: bsd-3-clause
- Created: 2016-05-19T14:09:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:15:05.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T22:42:39.846Z (14 days ago)
- Topics: collectstatic, django, parallelization, performance
- Language: Python
- Size: 15.6 KB
- Stars: 18
- Watchers: 9
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
====================
django-collectfaster
====================|pypi| |status|
.. |pypi| image:: https://badge.fury.io/py/django-collectfaster.png
:target: https://badge.fury.io/py/django-collectfaster
:alt: Latest Version.. |status| image:: https://img.shields.io/pypi/dm/django-collectfaster.svg
:target: https://pypi.python.org/pypi/django-collectfaster
:alt: DownloadsThis package extends Django's ``collectstatic`` management command with a ``--faster`` argument that activates the
parallel file copying. The speed improvement is especially helpful for remote storage backends like S3.Quickstart
----------Install django-collectfaster::
pip install django-collectfaster
Configure installed apps in your ``settings.py`` and make sure ``collectfaster`` is listed before ``django.contrib.staticfiles``::
INSTALLED_APPS = (
...,
'collectfaster',
'django.contrib.staticfiles',
'storages',
...,
)If you are using S3 with ``django-storages`` you probably already have this configured in your ``settings.py``::
AWS_S3_HOST = 's3-eu-west-1.amazonaws.com'
AWS_STORAGE_BUCKET_NAME = ''Set the storage backends for your static and media files in the ``settings.py``::
STATICFILES_STORAGE = 'collectfaster.backends.boto.S3StaticStorage'
DEFAULT_FILE_STORAGE = 'collectfaster.backends.boto.S3MediaStorage'
# STATICFILES_STORAGE = 'collectfaster.backends.boto3.S3Boto3StaticStorage'
# DEFAULT_FILE_STORAGE = 'collectfaster.backends.boto3.S3Boto3MediaStorage'You should split your static and media files on your S3 in different folders and configure it in the ``settings.py``::
STATICFILES_LOCATION = 'static'
MEDIAFILES_LOCATION = 'media'Set the ``STATIC_URL`` at least on your production settings::
STATIC_URL = 'https://%s/%s/%s/' % (AWS_S3_HOST, AWS_STORAGE_BUCKET_NAME, STATICFILES_LOCATION)
Usage
-----Collect your static files parallel::
python manage.py collectstatic --faster
Set the amount of workers to 30::
python manage.py collectstatic --faster --workers=30
Spawn workers using ``multiprocessing`` instead of ``gevent``::
python manage.py collectstatic --faster --use-multiprocessing
Credits
-------Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage