From 69566f54561cd5f7d0f7954a0423d4ad759337d6 Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Thu, 22 Aug 2019 14:57:00 +0200 Subject: [PATCH 01/29] Add context processor for settings variables This allows for usage of settings variables in templates, e.g ``` {% if settings.USE_ANALYTICS %} {% endif %} ``` --- {{cookiecutter.project_slug}}/config/settings/base.py | 1 + .../{{cookiecutter.project_slug}}/utils/__init__.py | 0 .../utils/context_processors.py | 5 +++++ 3 files changed, 6 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/__init__.py create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/context_processors.py diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 7def8f489..41f0f46cf 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -187,6 +187,7 @@ TEMPLATES = [ "django.template.context_processors.static", "django.template.context_processors.tz", "django.contrib.messages.context_processors.messages", + "{{ cookiecutter.project_slug }}.utils.context_processors.settings_context", ], }, } diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/__init__.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/context_processors.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/context_processors.py new file mode 100644 index 000000000..de405076f --- /dev/null +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/context_processors.py @@ -0,0 +1,5 @@ +from django.conf import settings + + +def settings_context(_request): + return {"settings": settings} From e5f9dd2c783a6ec63d7b606e8b5cb6b9d3c0eb3c Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sun, 8 Sep 2019 13:00:29 +0200 Subject: [PATCH 02/29] Update django-anymail from 6.1.0 to 7.0.0 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 1714398f4..1863a493b 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -18,4 +18,4 @@ django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'GCP' %} django-storages[google]==1.7.1 # https://github.com/jschneier/django-storages {%- endif %} -django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail +django-anymail[mailgun]==7.0.0 # https://github.com/anymail/django-anymail From db777571c457a92d85cbe08d2de12b06f3fede30 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 10 Sep 2019 13:00:29 +0200 Subject: [PATCH 03/29] Update django-storages from 1.7.1 to 1.7.2 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 1714398f4..379281ab8 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -14,7 +14,7 @@ sentry-sdk==0.11.2 # https://github.com/getsentry/sentry-python # Django # ------------------------------------------------------------------------------ {%- if cookiecutter.cloud_provider == 'AWS' %} -django-storages[boto3]==1.7.1 # https://github.com/jschneier/django-storages +django-storages[boto3]==1.7.2 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'GCP' %} django-storages[google]==1.7.1 # https://github.com/jschneier/django-storages {%- endif %} From fab5bf8a040b9d3467581bfadbb1eee4f97bcf56 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 10 Sep 2019 13:00:30 +0200 Subject: [PATCH 04/29] Update django-storages from 1.7.1 to 1.7.2 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 379281ab8..5b1387e29 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,6 +16,6 @@ sentry-sdk==0.11.2 # https://github.com/getsentry/sentry-python {%- if cookiecutter.cloud_provider == 'AWS' %} django-storages[boto3]==1.7.2 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'GCP' %} -django-storages[google]==1.7.1 # https://github.com/jschneier/django-storages +django-storages[google]==1.7.2 # https://github.com/jschneier/django-storages {%- endif %} django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail From f8963e0dd3935ebaff8614c4bde2af04f8e208c0 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Thu, 19 Sep 2019 12:00:30 +0100 Subject: [PATCH 05/29] Update sentry-sdk from 0.11.2 to 0.12.0 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 5b1387e29..a602a7007 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==1.0.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.11.2 # https://github.com/getsentry/sentry-python +sentry-sdk==0.12.0 # https://github.com/getsentry/sentry-python {%- endif %} # Django From ce3547e890459323d9fbfd3c7c9a4b5e3331b1e2 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 21 Sep 2019 12:00:30 +0100 Subject: [PATCH 06/29] Update sentry-sdk from 0.12.0 to 0.12.2 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index a602a7007..6dd363714 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==1.0.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.12.0 # https://github.com/getsentry/sentry-python +sentry-sdk==0.12.2 # https://github.com/getsentry/sentry-python {%- endif %} # Django From 02689f67e74c5117933174b374b4f6b02f91c80d Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 21 Sep 2019 12:00:33 +0100 Subject: [PATCH 07/29] Update python-slugify from 3.0.3 to 3.0.4 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 24198e557..ae16b0e8d 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,5 +1,5 @@ pytz==2019.2 # https://github.com/stub42/pytz -python-slugify==3.0.3 # https://github.com/un33k/python-slugify +python-slugify==3.0.4 # https://github.com/un33k/python-slugify Pillow==6.1.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin From 26ecff778e5bb61e52fb58bff6a745e381e8dae9 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sun, 22 Sep 2019 00:50:31 -0700 Subject: [PATCH 08/29] Update pytest from 5.1.2 to 5.1.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f4d12375d..a4eb4a533 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ flake8==3.7.8 # Testing # ------------------------------------------------------------------------------ tox==3.14.0 -pytest==5.1.2 +pytest==5.1.3 pytest_cases==1.11.2 pytest-cookies==0.4.0 pytest-xdist==1.29.0 From aa573427948b4cd25c9db74174953fc48b88f732 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Mon, 23 Sep 2019 12:00:28 +0100 Subject: [PATCH 09/29] Update pytest from 5.1.2 to 5.1.3 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index c1df0b84b..2b221294a 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -12,7 +12,7 @@ psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ mypy==0.720 # https://github.com/python/mypy -pytest==5.1.2 # https://github.com/pytest-dev/pytest +pytest==5.1.3 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality From e924a55d7875ea992104b0440f2eda6c725bcb37 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 25 Sep 2019 12:00:29 +0100 Subject: [PATCH 10/29] Update whitenoise from 4.1.3 to 4.1.4 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index ae16b0e8d..e2871f71d 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -6,7 +6,7 @@ rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == ' {%- endif %} argon2-cffi==19.1.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} -whitenoise==4.1.3 # https://github.com/evansd/whitenoise +whitenoise==4.1.4 # https://github.com/evansd/whitenoise {%- endif %} redis==3.3.8 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} From 9e5343dd31d64e3eea45e1d19dc944fe7f29cb8c Mon Sep 17 00:00:00 2001 From: browniebroke Date: Fri, 27 Sep 2019 12:00:30 +0100 Subject: [PATCH 11/29] Update mypy from 0.720 to 0.730 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 2b221294a..a96d64b40 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -mypy==0.720 # https://github.com/python/mypy +mypy==0.730 # https://github.com/python/mypy pytest==5.1.3 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar From d6b0bf8bb08769fb9cdf2e1d0a4b2a4a9a76de5c Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 30 Sep 2019 00:04:00 -0700 Subject: [PATCH 12/29] Update pytest from 5.1.3 to 5.2.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a4eb4a533..27787f52c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ flake8==3.7.8 # Testing # ------------------------------------------------------------------------------ tox==3.14.0 -pytest==5.1.3 +pytest==5.2.0 pytest_cases==1.11.2 pytest-cookies==0.4.0 pytest-xdist==1.29.0 From 4aed40d74d7a003037c55a255cede4d0a901716f Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 1 Oct 2019 12:00:29 +0100 Subject: [PATCH 13/29] Update django from 2.2.5 to 2.2.6 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index e2871f71d..a7620e3ca 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -19,7 +19,7 @@ flower==0.9.3 # https://github.com/mher/flower # Django # ------------------------------------------------------------------------------ -django==2.2.5 # pyup: < 3.0 # https://www.djangoproject.com/ +django==2.2.6 # pyup: < 3.0 # https://www.djangoproject.com/ django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==3.2.0 # https://github.com/jazzband/django-model-utils django-allauth==0.40.0 # https://github.com/pennersr/django-allauth From 7b73c2eb920b4979f42c284072e9de543889bd05 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 1 Oct 2019 12:00:33 +0100 Subject: [PATCH 14/29] Update pytest from 5.1.3 to 5.2.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index a96d64b40..fd2f4eb33 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -12,7 +12,7 @@ psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ mypy==0.730 # https://github.com/python/mypy -pytest==5.1.3 # https://github.com/pytest-dev/pytest +pytest==5.2.0 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality From da15657224b08e5cb026863b7dc35b596e62db4c Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Tue, 1 Oct 2019 08:29:41 -0700 Subject: [PATCH 15/29] Update pytest_cases from 1.11.2 to 1.11.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 27787f52c..a93b75a32 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ flake8==3.7.8 # ------------------------------------------------------------------------------ tox==3.14.0 pytest==5.2.0 -pytest_cases==1.11.2 +pytest_cases==1.11.3 pytest-cookies==0.4.0 pytest-xdist==1.29.0 pyyaml==5.1.2 From 0e5902027e86eef7886ffcf31ae0c98ba3007506 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Tue, 1 Oct 2019 15:06:58 -0700 Subject: [PATCH 16/29] Update pytest-xdist from 1.29.0 to 1.30.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a93b75a32..e9d2afb2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,5 +13,5 @@ tox==3.14.0 pytest==5.2.0 pytest_cases==1.11.3 pytest-cookies==0.4.0 -pytest-xdist==1.29.0 +pytest-xdist==1.30.0 pyyaml==5.1.2 From daa0265a39ab9b6e5a52a82c3d02dd7831713c89 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 2 Oct 2019 12:00:29 +0100 Subject: [PATCH 17/29] Update pillow from 6.1.0 to 6.2.0 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index a7620e3ca..d0bce1554 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,6 +1,6 @@ pytz==2019.2 # https://github.com/stub42/pytz python-slugify==3.0.4 # https://github.com/un33k/python-slugify -Pillow==6.1.0 # https://github.com/python-pillow/Pillow +Pillow==6.2.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin {%- endif %} From 8a471c97e8df910f6762b7dc257cf6ec1e867833 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 2 Oct 2019 12:00:33 +0100 Subject: [PATCH 18/29] Update django-extensions from 2.2.1 to 2.2.2 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index fd2f4eb33..1f5d7a549 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -30,6 +30,6 @@ pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==2.0 # https://github.com/jazzband/django-debug-toolbar -django-extensions==2.2.1 # https://github.com/django-extensions/django-extensions +django-extensions==2.2.2 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django From 8e1211580f0fbc77dd3394c4c6b91913a45d8c44 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 2 Oct 2019 13:39:16 +0100 Subject: [PATCH 19/29] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..9f4c97f31 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: danielroygreenfeld +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.patreon.com/browniebroke'] From 39e745dddf090aa1f06da1e5f6e12c669c3351a7 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Wed, 2 Oct 2019 10:10:32 -0300 Subject: [PATCH 20/29] Fix #2250 -- No staticfile storage with GCP without Whitenoise --- {{cookiecutter.project_slug}}/config/settings/production.py | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index e37411653..122871b17 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -107,6 +107,7 @@ STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" STATICFILES_STORAGE = "config.settings.production.StaticRootS3Boto3Storage" STATIC_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/static/" {% elif cookiecutter.cloud_provider == 'GCP' -%} +STATICFILES_STORAGE = "storages.backends.gcloud.GoogleCloudStorage" STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/" {% endif -%} From f3b46ec4251358b7dd5ae24236b7cd9cc0a0b441 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Wed, 2 Oct 2019 10:12:31 -0300 Subject: [PATCH 21/29] Add to CONTRIBUTORS --- CONTRIBUTORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4c3ad8a04..4bf682ff4 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -74,6 +74,7 @@ Listed in alphabetical order. Bouke Haarsma Brent Payne `@brentpayne`_ @brentpayne Burhan Khalid            `@burhan`_                   @burhan + Caio Ariede `@caioariede`_ @caioariede Carl Johnson `@carlmjohnson`_ @carlmjohnson Catherine Devlin `@catherinedevlin`_ Cédric Gaspoz `@cgaspoz`_ From d0c208d10fcd335b7b37a6a05d4d8ee72b995793 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Wed, 2 Oct 2019 12:03:33 -0300 Subject: [PATCH 22/29] Fix #2249 -- Broken static files with whitenoise=n & cloud_provider=none --- hooks/pre_gen_project.py | 9 +++++++++ tests/test_cookiecutter_generation.py | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 91332f144..7f9bd3eac 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -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) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 77f71df5b..dc729513c 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -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,10 @@ 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): + context.update({"use_whitenoise": "n", "cloud_provider": "None"}) + result = cookies.bake(extra_context=context) + + assert result.exit_code == 1 From 9fffafc0950e214db263be797249005c35ef7db7 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Wed, 2 Oct 2019 12:06:53 -0300 Subject: [PATCH 23/29] Add docstring --- tests/test_cookiecutter_generation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index dc729513c..b02bba360 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -165,6 +165,7 @@ def test_invalid_slug(cookies, context, slug): 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) From 6e27a8beac7fcf02221041d5dec88ca314dc5452 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Thu, 3 Oct 2019 12:00:31 +0100 Subject: [PATCH 24/29] Update sentry-sdk from 0.12.2 to 0.12.3 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 0d74f6d10..46c1a89e9 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==1.0.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.12.2 # https://github.com/getsentry/sentry-python +sentry-sdk==0.12.3 # https://github.com/getsentry/sentry-python {%- endif %} # Django From 9f1821cadfae6a9782fb92e7d044f197413e0833 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Thu, 3 Oct 2019 12:00:34 +0100 Subject: [PATCH 25/29] Update django-extensions from 2.2.2 to 2.2.3 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 1f5d7a549..41813c475 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -30,6 +30,6 @@ pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==2.0 # https://github.com/jazzband/django-debug-toolbar -django-extensions==2.2.2 # https://github.com/django-extensions/django-extensions +django-extensions==2.2.3 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django From 4f8834c0ebcf67d55fa8ed74b753ab665440d7b4 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Thu, 3 Oct 2019 11:54:15 -0300 Subject: [PATCH 26/29] Update tests/test_cookiecutter_generation.py Co-Authored-By: Bruno Alla --- tests/test_cookiecutter_generation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index b02bba360..20e4f9ed2 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -169,4 +169,5 @@ def test_no_whitenoise_and_no_cloud_provider(cookies, context): context.update({"use_whitenoise": "n", "cloud_provider": "None"}) result = cookies.bake(extra_context=context) - assert result.exit_code == 1 + assert result.exit_code != 0 + assert isinstance(result.exception, FailedHookException) From b8248f4758436d6ebb6ba79b7ad5c118de4d56de Mon Sep 17 00:00:00 2001 From: browniebroke Date: Fri, 4 Oct 2019 12:00:29 +0100 Subject: [PATCH 27/29] Update collectfast from 1.0.0 to 1.1.0 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 46c1a89e9..fae99a3f8 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -5,7 +5,7 @@ gunicorn==19.9.0 # https://github.com/benoitc/gunicorn psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- if cookiecutter.use_whitenoise == 'n' %} -Collectfast==1.0.0 # https://github.com/antonagestam/collectfast +Collectfast==1.1.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} sentry-sdk==0.12.3 # https://github.com/getsentry/sentry-python From ff8a9de24eb73e70dda87190d6e649ee39ecc180 Mon Sep 17 00:00:00 2001 From: Caio Ariede Date: Fri, 4 Oct 2019 09:32:25 -0300 Subject: [PATCH 28/29] Updates --- .../config/settings/production.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 122871b17..7a5d5454d 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -92,7 +92,6 @@ AWS_DEFAULT_ACL = None # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings AWS_S3_REGION_NAME = env("DJANGO_AWS_S3_REGION_NAME", default=None) {% elif cookiecutter.cloud_provider == 'GCP' %} -DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage" GS_BUCKET_NAME = env("DJANGO_GCP_STORAGE_BUCKET_NAME") GS_DEFAULT_ACL = "publicRead" {% endif -%} @@ -107,7 +106,7 @@ STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" STATICFILES_STORAGE = "config.settings.production.StaticRootS3Boto3Storage" STATIC_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/static/" {% elif cookiecutter.cloud_provider == 'GCP' -%} -STATICFILES_STORAGE = "storages.backends.gcloud.GoogleCloudStorage" +STATICFILES_STORAGE = "config.settings.production.StaticRootGoogleCloudStorage" STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/" {% endif -%} @@ -133,8 +132,21 @@ class MediaRootS3Boto3Storage(S3Boto3Storage): DEFAULT_FILE_STORAGE = "config.settings.production.MediaRootS3Boto3Storage" MEDIA_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/media/" {%- elif cookiecutter.cloud_provider == 'GCP' %} +from storages.backends.gcloud import GoogleCloudStorage # noqa E402 + + +class StaticRootGoogleCloudStorage(GoogleCloudStorage): + location = "static" + default_acl = "publicRead" + + +class MediaRootGoogleCloudStorage(GoogleCloudStorage): + location = "media" + file_overwrite = False + + +DEFAULT_FILE_STORAGE = "config.settings.production.MediaRootGoogleCloudStorage" MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/" -MEDIA_ROOT = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/" {%- endif %} # TEMPLATES From 99ccd314d0b4f67f0847fe847838c4afacd7c2e9 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 4 Oct 2019 14:48:02 +0100 Subject: [PATCH 29/29] Add missing link --- CONTRIBUTORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4bf682ff4..3a6c7bd0e 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -230,6 +230,7 @@ Listed in alphabetical order. .. _@c-rhodes: https://github.com/c-rhodes .. _@caffodian: https://github.com/caffodian .. _@canonnervio: https://github.com/canonnervio +.. _@caioariede: https://github.com/caioariede .. _@carlmjohnson: https://github.com/carlmjohnson .. _@catherinedevlin: https://github.com/catherinedevlin .. _@ccurvey: https://github.com/ccurvey