Fix issue with Whitenoise & compressor used together

This commit is contained in:
Bruno Alla 2019-03-27 20:49:17 +00:00
parent 65d68033cd
commit d0c4196390
2 changed files with 6 additions and 12 deletions

View File

@ -55,11 +55,8 @@ def check_paths(paths):
@pytest.mark.parametrize("use_celery", BINARY_CHOICES) @pytest.mark.parametrize("use_celery", BINARY_CHOICES)
@pytest.mark.parametrize("use_mailhog", BINARY_CHOICES) @pytest.mark.parametrize("use_mailhog", BINARY_CHOICES)
@pytest.mark.parametrize("use_sentry", BINARY_CHOICES) @pytest.mark.parametrize("use_sentry", BINARY_CHOICES)
@pytest.mark.parametrize( @pytest.mark.parametrize("use_compressor", BINARY_CHOICES)
# These 2 cannot be used together, but test the other combinations @pytest.mark.parametrize("use_whitenoise", BINARY_CHOICES)
["use_compressor", "use_whitenoise"],
[("y", "n"), ("n", "n"), ("n", "n")],
)
def test_project_generation( def test_project_generation(
cookies, cookies,
context, context,
@ -98,11 +95,8 @@ def test_project_generation(
@pytest.mark.parametrize("use_celery", BINARY_CHOICES) @pytest.mark.parametrize("use_celery", BINARY_CHOICES)
@pytest.mark.parametrize("use_mailhog", BINARY_CHOICES) @pytest.mark.parametrize("use_mailhog", BINARY_CHOICES)
@pytest.mark.parametrize("use_sentry", BINARY_CHOICES) @pytest.mark.parametrize("use_sentry", BINARY_CHOICES)
@pytest.mark.parametrize( @pytest.mark.parametrize("use_compressor", BINARY_CHOICES)
# These 2 cannot be used together, but test the other combinations @pytest.mark.parametrize("use_whitenoise", BINARY_CHOICES)
["use_compressor", "use_whitenoise"],
[("y", "n"), ("n", "n"), ("n", "n")],
)
def test_linting_passes( def test_linting_passes(
cookies, cookies,
windows, windows,
@ -113,7 +107,7 @@ def test_linting_passes(
use_compressor, use_compressor,
use_whitenoise, use_whitenoise,
): ):
"""generated project should pass flake8""" """generated project should pass flake8 & black."""
result = cookies.bake( result = cookies.bake(
extra_context={ extra_context={
"windows": windows, "windows": windows,

View File

@ -182,7 +182,7 @@ 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
COMPRESS_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" COMPRESS_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
# 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 COMPRESS_URL = STATIC_URL{% if cookiecutter.use_whitenoise == 'y' %} # noqa F405{% endif %}
{% endif %} {% endif %}
{%- if cookiecutter.use_whitenoise == 'n' -%} {%- if cookiecutter.use_whitenoise == 'n' -%}
# Collectfast # Collectfast