mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
- configure compressor when not using s3
- update django start script to compress if using whitenoise and compress enabled - add to contributors.rst
This commit is contained in:
parent
c54345e5f8
commit
89f85f1255
|
@ -129,6 +129,7 @@ Listed in alphabetical order.
|
||||||
Irfan Ahmad `@erfaan`_ @erfaan
|
Irfan Ahmad `@erfaan`_ @erfaan
|
||||||
Isaac12x `@Isaac12x`_
|
Isaac12x `@Isaac12x`_
|
||||||
Ivan Khomutov `@ikhomutov`_
|
Ivan Khomutov `@ikhomutov`_
|
||||||
|
James Williams `@jameswilliams1`_
|
||||||
Jan Van Bruggen `@jvanbrug`_
|
Jan Van Bruggen `@jvanbrug`_
|
||||||
Jelmer Draaijer `@foarsitter`_
|
Jelmer Draaijer `@foarsitter`_
|
||||||
Jerome Caisip `@jeromecaisip`_
|
Jerome Caisip `@jeromecaisip`_
|
||||||
|
|
|
@ -6,4 +6,10 @@ set -o nounset
|
||||||
|
|
||||||
|
|
||||||
python /app/manage.py collectstatic --noinput
|
python /app/manage.py collectstatic --noinput
|
||||||
|
{%- if cookiecutter.use_whitenoise == 'y' and cookiecutter.use_compressor == 'y' %}
|
||||||
|
if [ "${COMPRESS_ENABLED:-}" = "True" ];
|
||||||
|
then
|
||||||
|
python /app/manage.py compress
|
||||||
|
fi
|
||||||
|
{%- endif %}
|
||||||
/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
|
/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
|
||||||
|
|
|
@ -200,9 +200,27 @@ ANYMAIL = {
|
||||||
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED
|
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED
|
||||||
COMPRESS_ENABLED = env.bool("COMPRESS_ENABLED", default=True)
|
COMPRESS_ENABLED = env.bool("COMPRESS_ENABLED", default=True)
|
||||||
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_STORAGE
|
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_STORAGE
|
||||||
|
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
||||||
COMPRESS_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
COMPRESS_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||||
|
{%- elif cookiecutter.cloud_provider == 'GCP' %}
|
||||||
|
COMPRESS_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
|
||||||
|
{%- elif cookiecutter.cloud_provider == 'None' %}
|
||||||
|
COMPRESS_STORAGE = "compressor.storage.GzipCompressorFileStorage"
|
||||||
|
{%- endif %}
|
||||||
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_URL
|
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_URL
|
||||||
COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutter.cloud_provider == 'None' %} # noqa F405{% endif %}
|
COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' or cookiecutter.cloud_provider == 'None' %} # noqa F405{% endif %}
|
||||||
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||||
|
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_OFFLINE
|
||||||
|
COMPRESS_OFFLINE = True # Offline compression is required when using Whitenoise
|
||||||
|
{%- endif %}
|
||||||
|
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_FILTERS
|
||||||
|
COMPRESS_FILTERS = {
|
||||||
|
"css": [
|
||||||
|
"compressor.filters.css_default.CssAbsoluteFilter",
|
||||||
|
"compressor.filters.cssmin.rCSSMinFilter",
|
||||||
|
],
|
||||||
|
"js": ["compressor.filters.jsmin.JSMinFilter"],
|
||||||
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if cookiecutter.use_whitenoise == 'n' -%}
|
{%- if cookiecutter.use_whitenoise == 'n' -%}
|
||||||
# Collectfast
|
# Collectfast
|
||||||
|
|
Loading…
Reference in New Issue
Block a user