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_mailhog", BINARY_CHOICES)
@pytest.mark.parametrize("use_sentry", BINARY_CHOICES)
@pytest.mark.parametrize(
# These 2 cannot be used together, but test the other combinations
["use_compressor", "use_whitenoise"],
[("y", "n"), ("n", "n"), ("n", "n")],
)
@pytest.mark.parametrize("use_compressor", BINARY_CHOICES)
@pytest.mark.parametrize("use_whitenoise", BINARY_CHOICES)
def test_project_generation(
cookies,
context,
@ -98,11 +95,8 @@ def test_project_generation(
@pytest.mark.parametrize("use_celery", BINARY_CHOICES)
@pytest.mark.parametrize("use_mailhog", BINARY_CHOICES)
@pytest.mark.parametrize("use_sentry", BINARY_CHOICES)
@pytest.mark.parametrize(
# These 2 cannot be used together, but test the other combinations
["use_compressor", "use_whitenoise"],
[("y", "n"), ("n", "n"), ("n", "n")],
)
@pytest.mark.parametrize("use_compressor", BINARY_CHOICES)
@pytest.mark.parametrize("use_whitenoise", BINARY_CHOICES)
def test_linting_passes(
cookies,
windows,
@ -113,7 +107,7 @@ def test_linting_passes(
use_compressor,
use_whitenoise,
):
"""generated project should pass flake8"""
"""generated project should pass flake8 & black."""
result = cookies.bake(
extra_context={
"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
COMPRESS_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
# 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 %}
{%- if cookiecutter.use_whitenoise == 'n' -%}
# Collectfast