mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
Fix #2249 -- Broken static files with whitenoise=n & cloud_provider=none
This commit is contained in:
commit
769b7bb882
|
@ -59,3 +59,12 @@ if "{{ cookiecutter.use_docker }}".lower() == "n":
|
|||
)
|
||||
+ TERMINATOR
|
||||
)
|
||||
|
||||
if (
|
||||
"{{ cookiecutter.use_whitenoise }}".lower() == "n"
|
||||
and "{{ cookiecutter.cloud_provider }}" == "None"
|
||||
):
|
||||
print(
|
||||
"You should either use Whitenoise or select a Cloud Provider to serve static files"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -49,6 +49,11 @@ def context_combination(
|
|||
cloud_provider,
|
||||
):
|
||||
"""Fixture that parametrize the function where it's used."""
|
||||
if cloud_provider == "None":
|
||||
# Either of the two should be set for serving static files, so if cloud provider
|
||||
# is not set, we force Whitenoise to be set
|
||||
use_whitenoise = "y"
|
||||
|
||||
return {
|
||||
"windows": windows,
|
||||
"use_docker": use_docker,
|
||||
|
@ -157,3 +162,12 @@ def test_invalid_slug(cookies, context, slug):
|
|||
|
||||
assert result.exit_code != 0
|
||||
assert isinstance(result.exception, FailedHookException)
|
||||
|
||||
|
||||
def test_no_whitenoise_and_no_cloud_provider(cookies, context):
|
||||
"""It should not generate project if neither whitenoise or cloud provider are set"""
|
||||
context.update({"use_whitenoise": "n", "cloud_provider": "None"})
|
||||
result = cookies.bake(extra_context=context)
|
||||
|
||||
assert result.exit_code != 0
|
||||
assert isinstance(result.exception, FailedHookException)
|
||||
|
|
Loading…
Reference in New Issue
Block a user