From f690119cd99903e3db62718f4534f3fe03e57163 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 11 Jan 2023 17:18:03 -0500 Subject: [PATCH 001/385] Update tox to 4.2.7 (#4073) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bc164293d..4a604db16 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pre-commit==2.21.0 # Testing # ------------------------------------------------------------------------------ -tox==4.2.6 +tox==4.2.7 pytest==7.2.0 pytest-cookies==0.6.1 pytest-instafail==0.4.2 From 541c1dce9e5abf52076e39671b930efe9c834117 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 12 Jan 2023 02:41:37 +0000 Subject: [PATCH 002/385] Release 2023.01.11 --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecd6023af..2cb53128c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.11 + +### Changed +- Update Celery instructions in the documentation ([#4061](https://github.com/cookiecutter/cookiecutter-django/pull/4061)) +### Updated +- Update tox to 4.2.7 ([#4073](https://github.com/cookiecutter/cookiecutter-django/pull/4073)) + ## 2023.01.10 ### Changed diff --git a/setup.py b/setup.py index 397500054..5b1bc3b26 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.10" +version = "2023.01.11" with open("README.rst") as readme_file: long_description = readme_file.read() From fe6e6e85cbcd6dbb78d3427a6c971a74fecd5223 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 12 Jan 2023 13:28:26 -0500 Subject: [PATCH 003/385] Update sentry-sdk to 1.13.0 (#4074) --- {{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 ce3e9f3fe..fd449d1fe 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.9.5 # https://github.com/psycopg/psycopg2 Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==1.12.1 # https://github.com/getsentry/sentry-python +sentry-sdk==1.13.0 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} hiredis==2.1.1 # https://github.com/redis/hiredis-py From f50a2a5b0f5d9aa03a815be0e0c577f40983e67c Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 13 Jan 2023 02:46:24 +0000 Subject: [PATCH 004/385] Release 2023.01.12 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb53128c..5269ac14d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.12 + +### Updated +- Update sentry-sdk to 1.13.0 ([#4074](https://github.com/cookiecutter/cookiecutter-django/pull/4074)) + ## 2023.01.11 ### Changed diff --git a/setup.py b/setup.py index 5b1bc3b26..765459067 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.11" +version = "2023.01.12" with open("README.rst") as readme_file: long_description = readme_file.read() From 54df65c7779d7e0764645acd529ba5673d0090fe Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 15 Jan 2023 06:32:56 -0500 Subject: [PATCH 005/385] Update pytz from 2022.7 to 2022.7.1 (#4078) --- {{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 06be3c65c..38f8daabf 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,4 +1,4 @@ -pytz==2022.7 # https://github.com/stub42/pytz +pytz==2022.7.1 # https://github.com/stub42/pytz python-slugify==7.0.0 # https://github.com/un33k/python-slugify Pillow==9.4.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} From 5d07f3bb7ef142b7bd7a4d7e7f062775896ea021 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 15 Jan 2023 06:33:58 -0500 Subject: [PATCH 006/385] Update pytest to 7.2.1 (#4077) * Update pytest from 7.2.0 to 7.2.1 * Update pytest from 7.2.0 to 7.2.1 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4a604db16..627cfebe5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ pre-commit==2.21.0 # Testing # ------------------------------------------------------------------------------ tox==4.2.7 -pytest==7.2.0 +pytest==7.2.1 pytest-cookies==0.6.1 pytest-instafail==0.4.2 pyyaml==6.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index b9b4d2008..89abc0a0e 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -15,7 +15,7 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles # ------------------------------------------------------------------------------ mypy==0.982 # https://github.com/python/mypy django-stubs==1.13.1 # https://github.com/typeddjango/django-stubs -pytest==7.2.0 # https://github.com/pytest-dev/pytest +pytest==7.2.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs From 3f53a2695b0824a1ccd1b62e866568fce53a2c08 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 16 Jan 2023 02:26:38 +0000 Subject: [PATCH 007/385] Release 2023.01.15 --- CHANGELOG.md | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5269ac14d..00698a012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.15 + +### Updated +- Update pytest to 7.2.1 ([#4077](https://github.com/cookiecutter/cookiecutter-django/pull/4077)) +- Update pytz to 2022.7.1 ([#4078](https://github.com/cookiecutter/cookiecutter-django/pull/4078)) + ## 2023.01.12 ### Updated diff --git a/setup.py b/setup.py index 765459067..cdbbc6929 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.12" +version = "2023.01.15" with open("README.rst") as readme_file: long_description = readme_file.read() From 52af00670683ac20d42c4119580ab4a2fbe0109d Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 17 Jan 2023 04:38:25 -0500 Subject: [PATCH 008/385] Update tox to 4.3.3 (#4081) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 627cfebe5..5dc9d97ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pre-commit==2.21.0 # Testing # ------------------------------------------------------------------------------ -tox==4.2.7 +tox==4.3.3 pytest==7.2.1 pytest-cookies==0.6.1 pytest-instafail==0.4.2 From 23b41967a854e023d0a63fa502ba13fba81ada8b Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 18 Jan 2023 02:27:46 +0000 Subject: [PATCH 009/385] Release 2023.01.17 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00698a012..344978d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.17 + +### Updated +- Update tox to 4.3.3 ([#4081](https://github.com/cookiecutter/cookiecutter-django/pull/4081)) + ## 2023.01.15 ### Updated diff --git a/setup.py b/setup.py index cdbbc6929..1b0f44843 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.15" +version = "2023.01.17" with open("README.rst") as readme_file: long_description = readme_file.read() From be8aa5c73dc88259e819534a3bdb71f9364e82b9 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Thu, 19 Jan 2023 14:45:56 -0800 Subject: [PATCH 010/385] Add sourcemaps support to Gulp (#4089) fixes https://github.com/cookiecutter/cookiecutter-django/issues/4045 --- {{cookiecutter.project_slug}}/.gitignore | 1 + {{cookiecutter.project_slug}}/gulpfile.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index acc484307..17e9249c0 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -346,4 +346,5 @@ project.css project.min.css vendors.js *.min.js +*.min.js.map {%- endif %} diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index 680e3672e..40d367bcd 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -85,13 +85,13 @@ function scripts() { // Vendor Javascript minification function vendorScripts() { - return src(paths.vendorsJs) + return src(paths.vendorsJs, { sourcemaps: true }) .pipe(concat('vendors.js')) .pipe(dest(paths.js)) .pipe(plumber()) // Checks for errors .pipe(uglify()) // Minifies the js .pipe(rename({ suffix: '.min' })) - .pipe(dest(paths.js)) + .pipe(dest(paths.js, { sourcemaps: '.' })) } // Image compression From f4ab7bf671221195e5cd7241f2b551beff40594a Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 19 Jan 2023 18:10:06 -0500 Subject: [PATCH 011/385] Update tox to 4.3.5 (#4087) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5dc9d97ab..6d0f15b64 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pre-commit==2.21.0 # Testing # ------------------------------------------------------------------------------ -tox==4.3.3 +tox==4.3.5 pytest==7.2.1 pytest-cookies==0.6.1 pytest-instafail==0.4.2 From 502d978e222f25f73f294067c5e4b0e655c04e73 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 19 Jan 2023 18:54:31 -0500 Subject: [PATCH 012/385] Update requests from 2.28.1 to 2.28.2 (#4090) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6d0f15b64..add5fb030 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,4 @@ pyyaml==6.0 PyGithub==1.57 gitpython==3.1.30 jinja2==3.1.2 -requests==2.28.1 +requests==2.28.2 From 4576c70a5d902e9495fd58f5cd91f2badd7070e1 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 19 Jan 2023 18:55:31 -0500 Subject: [PATCH 013/385] Update redis from 4.4.1 to 4.4.2 (#4091) --- {{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 38f8daabf..6c29d5d2d 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -12,7 +12,7 @@ argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==6.3.0 # https://github.com/evansd/whitenoise {%- endif %} -redis==4.4.1 # https://github.com/redis/redis-py +redis==4.4.2 # https://github.com/redis/redis-py {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} hiredis==2.1.1 # https://github.com/redis/hiredis-py {%- endif %} From c5b0db3c635ffaf2d601c536cf3be0f5016dc4e3 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 19 Jan 2023 18:56:01 -0500 Subject: [PATCH 014/385] Update coverage from 7.0.4 to 7.0.5 (#4092) --- {{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 89abc0a0e..6560033ef 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -30,7 +30,7 @@ sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild # ------------------------------------------------------------------------------ flake8==6.0.0 # https://github.com/PyCQA/flake8 flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort -coverage==7.0.4 # https://github.com/nedbat/coveragepy +coverage==7.0.5 # https://github.com/nedbat/coveragepy black==22.12.0 # https://github.com/psf/black pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} From e5db124479b1004e339555a746c60489213812ac Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 20 Jan 2023 02:28:57 +0000 Subject: [PATCH 015/385] Release 2023.01.19 --- CHANGELOG.md | 10 ++++++++++ setup.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 344978d0a..c383e84f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.19 + +### Fixed +- Add sourcemaps support to Gulp ([#4089](https://github.com/cookiecutter/cookiecutter-django/pull/4089)) +### Updated +- Update coverage to 7.0.5 ([#4092](https://github.com/cookiecutter/cookiecutter-django/pull/4092)) +- Update redis to 4.4.2 ([#4091](https://github.com/cookiecutter/cookiecutter-django/pull/4091)) +- Update requests to 2.28.2 ([#4090](https://github.com/cookiecutter/cookiecutter-django/pull/4090)) +- Update tox to 4.3.5 ([#4087](https://github.com/cookiecutter/cookiecutter-django/pull/4087)) + ## 2023.01.17 ### Updated diff --git a/setup.py b/setup.py index 1b0f44843..53c2d0709 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.17" +version = "2023.01.19" with open("README.rst") as readme_file: long_description = readme_file.read() From 403298fcdcfbef64b897a4f9d0d3e23d4605fe7c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 21 Jan 2023 11:55:33 -0500 Subject: [PATCH 016/385] Update django-stubs from 1.13.1 to 1.13.2 (#4093) --- {{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 6560033ef..7436d32b9 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -14,7 +14,7 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles # Testing # ------------------------------------------------------------------------------ mypy==0.982 # https://github.com/python/mypy -django-stubs==1.13.1 # https://github.com/typeddjango/django-stubs +django-stubs==1.13.2 # https://github.com/typeddjango/django-stubs pytest==7.2.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} From 4d087f98be29dd95832fd693411ea339413eecf1 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 22 Jan 2023 02:28:22 +0000 Subject: [PATCH 017/385] Release 2023.01.21 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c383e84f5..6f347395a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.21 + +### Updated +- Update django-stubs to 1.13.2 ([#4093](https://github.com/cookiecutter/cookiecutter-django/pull/4093)) + ## 2023.01.19 ### Fixed diff --git a/setup.py b/setup.py index 53c2d0709..d1e91c223 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.19" +version = "2023.01.21" with open("README.rst") as readme_file: long_description = readme_file.read() From 6a601208ea30e2d1d9c5188d08bc4ff4567a0de3 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 22 Jan 2023 09:54:59 -0500 Subject: [PATCH 018/385] Update django-compressor from 4.3 to 4.3.1 (#4094) --- {{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 6c29d5d2d..b695d5af8 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -36,7 +36,7 @@ django-allauth==0.52.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5 {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} -django-compressor==4.3 # https://github.com/django-compressor/django-compressor +django-compressor==4.3.1 # https://github.com/django-compressor/django-compressor {%- endif %} django-redis==5.2.0 # https://github.com/jazzband/django-redis {%- if cookiecutter.use_drf == 'y' %} From ca18b6dc7c58b04b1dc3270e29132109e6c46fe6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 23 Jan 2023 02:25:09 +0000 Subject: [PATCH 019/385] Release 2023.01.22 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f347395a..494a67075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.22 + +### Updated +- Update django-compressor to 4.3.1 ([#4094](https://github.com/cookiecutter/cookiecutter-django/pull/4094)) + ## 2023.01.21 ### Updated diff --git a/setup.py b/setup.py index d1e91c223..17ef3ffe5 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.21" +version = "2023.01.22" with open("README.rst") as readme_file: long_description = readme_file.read() From e2a7647d3c2327dc4335358ba7a315de5c4d6c18 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 23 Jan 2023 12:21:21 -0500 Subject: [PATCH 020/385] Update sentry-sdk to 1.14.0 (#4096) --- {{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 fd449d1fe..6936adffd 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.9.5 # https://github.com/psycopg/psycopg2 Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==1.13.0 # https://github.com/getsentry/sentry-python +sentry-sdk==1.14.0 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} hiredis==2.1.1 # https://github.com/redis/hiredis-py From 0cd6a66a262d26c4c84aeb3cc49de2e8a35b331f Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 24 Jan 2023 02:23:48 +0000 Subject: [PATCH 021/385] Release 2023.01.23 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 494a67075..a2187d744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.23 + +### Updated +- Update sentry-sdk to 1.14.0 ([#4096](https://github.com/cookiecutter/cookiecutter-django/pull/4096)) + ## 2023.01.22 ### Updated diff --git a/setup.py b/setup.py index 17ef3ffe5..20df0c815 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.22" +version = "2023.01.23" with open("README.rst") as readme_file: long_description = readme_file.read() From 3361c75fbcf3305cd00bf4790838a5a75a215b97 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 24 Jan 2023 05:43:45 -0500 Subject: [PATCH 022/385] Update pre-commit to 3.0.0 (#4098) * Update pre-commit from 2.21.0 to 3.0.0 * Update pre-commit from 2.21.0 to 3.0.0 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index add5fb030..44e403020 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ black==22.12.0 isort==5.11.4 flake8==6.0.0 flake8-isort==6.0.0 -pre-commit==2.21.0 +pre-commit==3.0.0 # Testing # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 7436d32b9..782846f82 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -36,7 +36,7 @@ pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery {%- endif %} -pre-commit==2.21.0 # https://github.com/pre-commit/pre-commit +pre-commit==3.0.0 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ From 030b00177a98359ff4e81049ee05d6ca7aad67f9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 25 Jan 2023 02:24:52 +0000 Subject: [PATCH 023/385] Release 2023.01.24 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2187d744..32cb28daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.24 + +### Updated +- Update pre-commit to 3.0.0 ([#4098](https://github.com/cookiecutter/cookiecutter-django/pull/4098)) + ## 2023.01.23 ### Updated diff --git a/setup.py b/setup.py index 20df0c815..0453c33ba 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.23" +version = "2023.01.24" with open("README.rst") as readme_file: long_description = readme_file.read() From 2dc964a8e3feb443b7c19a99ecd174e1b9230adf Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 25 Jan 2023 03:50:58 -0500 Subject: [PATCH 024/385] Update coverage from 7.0.5 to 7.1.0 (#4100) --- {{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 782846f82..447104dae 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -30,7 +30,7 @@ sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild # ------------------------------------------------------------------------------ flake8==6.0.0 # https://github.com/PyCQA/flake8 flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort -coverage==7.0.5 # https://github.com/nedbat/coveragepy +coverage==7.1.0 # https://github.com/nedbat/coveragepy black==22.12.0 # https://github.com/psf/black pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} From dfd8164ef82512e7ee62f5954a78af93fc72bc18 Mon Sep 17 00:00:00 2001 From: Patrick Tran Date: Wed, 25 Jan 2023 04:50:41 -0800 Subject: [PATCH 025/385] Update postgres and redis to point to mini tiers (#4099) * Update postgres and redis to point to mini tiers * Update deployment-on-heroku.rst * Update deployment-on-heroku.rst --- docs/deployment-on-heroku.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index e239b6593..71fb45dda 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -12,13 +12,13 @@ Run these commands to deploy the project to Heroku: heroku create --buildpack heroku/python - heroku addons:create heroku-postgresql:hobby-dev + heroku addons:create heroku-postgresql:mini # On Windows use double quotes for the time zone, e.g. # heroku pg:backups schedule --at "02:00 America/Los_Angeles" DATABASE_URL heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL heroku pg:promote DATABASE_URL - heroku addons:create heroku-redis:hobby-dev + heroku addons:create heroku-redis:mini # Assuming you chose Mailgun as mail service (see below for others) heroku addons:create mailgun:starter @@ -125,4 +125,4 @@ which runs Gulp in cookiecutter-django. If things don't work, please refer to the Heroku docs. -.. _multiple buildpacks: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app \ No newline at end of file +.. _multiple buildpacks: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app From cb99f0d2115df1df2deb8716e79e6611309a10bd Mon Sep 17 00:00:00 2001 From: luzfcb Date: Wed, 25 Jan 2023 12:51:16 +0000 Subject: [PATCH 026/385] Update Contributors --- .github/contributors.json | 5 +++++ CONTRIBUTORS.md | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/.github/contributors.json b/.github/contributors.json index 34c84979d..9d60e5da1 100644 --- a/.github/contributors.json +++ b/.github/contributors.json @@ -1347,5 +1347,10 @@ "name": "Robin", "github_login": "Kaffeetasse", "twitter_username": "" + }, + { + "name": "Patrick Tran", + "github_login": "theptrk", + "twitter_username": "" } ] \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 718d58c57..3d85b68ac 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1475,6 +1475,13 @@ Listed in alphabetical order. + + Patrick Tran + + theptrk + + + Pawan Chaurasia From 70014c2b45b5f794a4fd4c82cb73ad52255d17ce Mon Sep 17 00:00:00 2001 From: tildebox <61698441+tildebox@users.noreply.github.com> Date: Wed, 25 Jan 2023 23:55:08 +0100 Subject: [PATCH 027/385] Rename ROOT_DIR to BASE_DIR (#4086) Co-authored-by: example Fix https://github.com/cookiecutter/cookiecutter-django/issues/4075 --- tests/test_cookiecutter_generation.py | 4 ++-- {{cookiecutter.project_slug}}/config/asgi.py | 4 ++-- {{cookiecutter.project_slug}}/config/settings/base.py | 10 +++++----- {{cookiecutter.project_slug}}/config/wsgi.py | 4 ++-- .../merge_production_dotenvs_in_dotenv.py | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 6219f75ef..3a881cc64 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -134,11 +134,11 @@ def _fixture_id(ctx): return "-".join(f"{key}:{value}" for key, value in ctx.items()) -def build_files_list(root_dir): +def build_files_list(base_dir): """Build a list containing absolute paths to the generated files.""" return [ os.path.join(dirpath, file_path) - for dirpath, subdirs, files in os.walk(root_dir) + for dirpath, subdirs, files in os.walk(base_dir) for file_path in files ] diff --git a/{{cookiecutter.project_slug}}/config/asgi.py b/{{cookiecutter.project_slug}}/config/asgi.py index 8c99bbf53..65e76ca0a 100644 --- a/{{cookiecutter.project_slug}}/config/asgi.py +++ b/{{cookiecutter.project_slug}}/config/asgi.py @@ -15,8 +15,8 @@ from django.core.asgi import get_asgi_application # This allows easy placement of apps within the interior # {{ cookiecutter.project_slug }} directory. -ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent -sys.path.append(str(ROOT_DIR / "{{ cookiecutter.project_slug }}")) +BASE_DIR = Path(__file__).resolve(strict=True).parent.parent +sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}")) # If DJANGO_SETTINGS_MODULE is unset, default to the local settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 6bf6a6e5c..44b03fa03 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -5,15 +5,15 @@ from pathlib import Path import environ -ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent +BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent # {{ cookiecutter.project_slug }}/ -APPS_DIR = ROOT_DIR / "{{ cookiecutter.project_slug }}" +APPS_DIR = BASE_DIR / "{{ cookiecutter.project_slug }}" env = environ.Env() READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False) if READ_DOT_ENV_FILE: # OS environment variables take precedence over variables from .env - env.read_env(str(ROOT_DIR / ".env")) + env.read_env(str(BASE_DIR / ".env")) # GENERAL # ------------------------------------------------------------------------------ @@ -33,7 +33,7 @@ USE_I18N = True # https://docs.djangoproject.com/en/dev/ref/settings/#use-tz USE_TZ = True # https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths -LOCALE_PATHS = [str(ROOT_DIR / "locale")] +LOCALE_PATHS = [str(BASE_DIR / "locale")] # DATABASES # ------------------------------------------------------------------------------ @@ -159,7 +159,7 @@ MIDDLEWARE = [ # STATIC # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#static-root -STATIC_ROOT = str(ROOT_DIR / "staticfiles") +STATIC_ROOT = str(BASE_DIR / "staticfiles") # https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = "/static/" # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS diff --git a/{{cookiecutter.project_slug}}/config/wsgi.py b/{{cookiecutter.project_slug}}/config/wsgi.py index a7de581ca..3fd809ef3 100644 --- a/{{cookiecutter.project_slug}}/config/wsgi.py +++ b/{{cookiecutter.project_slug}}/config/wsgi.py @@ -21,8 +21,8 @@ from django.core.wsgi import get_wsgi_application # This allows easy placement of apps within the interior # {{ cookiecutter.project_slug }} directory. -ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent -sys.path.append(str(ROOT_DIR / "{{ cookiecutter.project_slug }}")) +BASE_DIR = Path(__file__).resolve(strict=True).parent.parent +sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}")) # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use # mod_wsgi daemon mode with each site in its own daemon process, or use diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index d702a5f67..e5f82504a 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -4,13 +4,13 @@ from pathlib import Path import pytest -ROOT_DIR_PATH = Path(__file__).parent.resolve() -PRODUCTION_DOTENVS_DIR_PATH = ROOT_DIR_PATH / ".envs" / ".production" +BASE_DIR_PATH = Path(__file__).parent.resolve() +PRODUCTION_DOTENVS_DIR_PATH = BASE_DIR_PATH / ".envs" / ".production" PRODUCTION_DOTENV_FILE_PATHS = [ PRODUCTION_DOTENVS_DIR_PATH / ".django", PRODUCTION_DOTENVS_DIR_PATH / ".postgres", ] -DOTENV_FILE_PATH = ROOT_DIR_PATH / ".env" +DOTENV_FILE_PATH = BASE_DIR_PATH / ".env" def merge( From 56f6ba922d8c3f3151f2e2a6b6b430706e958181 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 25 Jan 2023 23:40:00 +0000 Subject: [PATCH 028/385] Update Contributors --- .github/contributors.json | 5 +++++ CONTRIBUTORS.md | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/.github/contributors.json b/.github/contributors.json index 9d60e5da1..0f923e027 100644 --- a/.github/contributors.json +++ b/.github/contributors.json @@ -1352,5 +1352,10 @@ "name": "Patrick Tran", "github_login": "theptrk", "twitter_username": "" + }, + { + "name": "tildebox", + "github_login": "tildebox", + "twitter_username": "" } ] \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 3d85b68ac..57194bca3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1741,6 +1741,13 @@ Listed in alphabetical order. + + tildebox + + tildebox + + + Tim Claessens From ef461f9231a4509175d2ef510fb40dd7ec840883 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 26 Jan 2023 02:25:13 +0000 Subject: [PATCH 029/385] Release 2023.01.25 --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32cb28daa..5b1b47b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.25 + +### Changed +- Rename ROOT_DIR to BASE_DIR ([#4086](https://github.com/cookiecutter/cookiecutter-django/pull/4086)) +- Update postgres and redis to point to mini tiers ([#4099](https://github.com/cookiecutter/cookiecutter-django/pull/4099)) +### Updated +- Update coverage to 7.1.0 ([#4100](https://github.com/cookiecutter/cookiecutter-django/pull/4100)) + ## 2023.01.24 ### Updated diff --git a/setup.py b/setup.py index 0453c33ba..9dd893f97 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.24" +version = "2023.01.25" with open("README.rst") as readme_file: long_description = readme_file.read() From 7fcdeeae88ad998b652c518c86e91aed13e6a6dd Mon Sep 17 00:00:00 2001 From: tildebox <61698441+tildebox@users.noreply.github.com> Date: Thu, 26 Jan 2023 09:50:33 +0100 Subject: [PATCH 030/385] Rename BASE_DIR_PATH to BASE_DIR (#4102) Co-authored-by: example --- .../merge_production_dotenvs_in_dotenv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index e5f82504a..80780ead5 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -4,13 +4,13 @@ from pathlib import Path import pytest -BASE_DIR_PATH = Path(__file__).parent.resolve() -PRODUCTION_DOTENVS_DIR_PATH = BASE_DIR_PATH / ".envs" / ".production" +BASE_DIR = Path(__file__).parent.resolve() +PRODUCTION_DOTENVS_DIR_PATH = BASE_DIR / ".envs" / ".production" PRODUCTION_DOTENV_FILE_PATHS = [ PRODUCTION_DOTENVS_DIR_PATH / ".django", PRODUCTION_DOTENVS_DIR_PATH / ".postgres", ] -DOTENV_FILE_PATH = BASE_DIR_PATH / ".env" +DOTENV_FILE_PATH = BASE_DIR / ".env" def merge( From 099e49b7284e8f74f9ddf2c8a485d2cb3056246f Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 26 Jan 2023 05:40:44 -0500 Subject: [PATCH 031/385] Update tox to 4.4.2 (#4101) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 44e403020..62e005a5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pre-commit==3.0.0 # Testing # ------------------------------------------------------------------------------ -tox==4.3.5 +tox==4.4.2 pytest==7.2.1 pytest-cookies==0.6.1 pytest-instafail==0.4.2 From 80405234c8e8ee16adb579a8e2d0b595efd505b3 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 26 Jan 2023 15:21:47 -0500 Subject: [PATCH 032/385] Update pre-commit to 3.0.1 (#4104) --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 62e005a5b..ab9c8c8b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ black==22.12.0 isort==5.11.4 flake8==6.0.0 flake8-isort==6.0.0 -pre-commit==3.0.0 +pre-commit==3.0.1 # Testing # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 447104dae..609b49789 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -36,7 +36,7 @@ pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery {%- endif %} -pre-commit==3.0.0 # https://github.com/pre-commit/pre-commit +pre-commit==3.0.1 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ From 8ba930cd488f82989412f440ae3632a8751b706b Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 27 Jan 2023 02:27:06 +0000 Subject: [PATCH 033/385] Release 2023.01.26 --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b1b47b52..32b3850fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.26 + +### Changed +- Rename BASE_DIR_PATH to BASE_DIR ([#4102](https://github.com/cookiecutter/cookiecutter-django/pull/4102)) +### Updated +- Update pre-commit to 3.0.1 ([#4104](https://github.com/cookiecutter/cookiecutter-django/pull/4104)) +- Update tox to 4.4.2 ([#4101](https://github.com/cookiecutter/cookiecutter-django/pull/4101)) + ## 2023.01.25 ### Changed diff --git a/setup.py b/setup.py index 9dd893f97..8e98d5142 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.25" +version = "2023.01.26" with open("README.rst") as readme_file: long_description = readme_file.read() From 900473777d9a80bf3e127d9b9b959a2257bb3202 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 27 Jan 2023 15:34:29 -0500 Subject: [PATCH 034/385] Update django-stubs to 1.14.0 (#4103) --- {{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 609b49789..ef0342a32 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -14,7 +14,7 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles # Testing # ------------------------------------------------------------------------------ mypy==0.982 # https://github.com/python/mypy -django-stubs==1.13.2 # https://github.com/typeddjango/django-stubs +django-stubs==1.14.0 # https://github.com/typeddjango/django-stubs pytest==7.2.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} From 0f635887b40e862769cec781a3a3f9fd85ddec7a Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 28 Jan 2023 02:26:35 +0000 Subject: [PATCH 035/385] Release 2023.01.27 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b3850fa..a55da25e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.27 + +### Updated +- Update django-stubs to 1.14.0 ([#4103](https://github.com/cookiecutter/cookiecutter-django/pull/4103)) + ## 2023.01.26 ### Changed diff --git a/setup.py b/setup.py index 8e98d5142..5adbbc664 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.26" +version = "2023.01.27" with open("README.rst") as readme_file: long_description = readme_file.read() From c0e83b104cd0713c8be80d55cda95d821f14a58d Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 28 Jan 2023 15:10:45 +0000 Subject: [PATCH 036/385] Refactor `merge_production_dotenvs_in_dotenv.py` (#4105) --- hooks/post_gen_project.py | 1 + .../merge_production_dotenvs_in_dotenv.py | 67 ++++--------------- ...test_merge_production_dotenvs_in_dotenv.py | 34 ++++++++++ 3 files changed, 48 insertions(+), 54 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9c3d946c1..5655b61f9 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -293,6 +293,7 @@ def set_flags_in_settings_files(): def remove_envs_and_associated_files(): shutil.rmtree(".envs") os.remove("merge_production_dotenvs_in_dotenv.py") + shutil.rmtree("tests") def remove_celery_compose_dirs(): diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index 80780ead5..35139fb2e 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -2,66 +2,25 @@ import os from collections.abc import Sequence from pathlib import Path -import pytest - BASE_DIR = Path(__file__).parent.resolve() -PRODUCTION_DOTENVS_DIR_PATH = BASE_DIR / ".envs" / ".production" -PRODUCTION_DOTENV_FILE_PATHS = [ - PRODUCTION_DOTENVS_DIR_PATH / ".django", - PRODUCTION_DOTENVS_DIR_PATH / ".postgres", +PRODUCTION_DOTENVS_DIR = BASE_DIR / ".envs" / ".production" +PRODUCTION_DOTENV_FILES = [ + PRODUCTION_DOTENVS_DIR / ".django", + PRODUCTION_DOTENVS_DIR / ".postgres", ] -DOTENV_FILE_PATH = BASE_DIR / ".env" +DOTENV_FILE = BASE_DIR / ".env" def merge( - output_file_path: str, merged_file_paths: Sequence[str], append_linesep: bool = True + output_file: Path, + files_to_merge: Sequence[Path], ) -> None: - with open(output_file_path, "w") as output_file: - for merged_file_path in merged_file_paths: - with open(merged_file_path) as merged_file: - merged_file_content = merged_file.read() - output_file.write(merged_file_content) - if append_linesep: - output_file.write(os.linesep) - - -def main(): - merge(DOTENV_FILE_PATH, PRODUCTION_DOTENV_FILE_PATHS) - - -@pytest.mark.parametrize("merged_file_count", range(3)) -@pytest.mark.parametrize("append_linesep", [True, False]) -def test_merge(tmpdir_factory, merged_file_count: int, append_linesep: bool): - tmp_dir_path = Path(str(tmpdir_factory.getbasetemp())) - - output_file_path = tmp_dir_path / ".env" - - expected_output_file_content = "" - merged_file_paths = [] - for i in range(merged_file_count): - merged_file_ord = i + 1 - - merged_filename = f".service{merged_file_ord}" - merged_file_path = tmp_dir_path / merged_filename - - merged_file_content = merged_filename * merged_file_ord - - with open(merged_file_path, "w+") as file: - file.write(merged_file_content) - - expected_output_file_content += merged_file_content - if append_linesep: - expected_output_file_content += os.linesep - - merged_file_paths.append(merged_file_path) - - merge(output_file_path, merged_file_paths, append_linesep) - - with open(output_file_path) as output_file: - actual_output_file_content = output_file.read() - - assert actual_output_file_content == expected_output_file_content + merged_content = "" + for merge_file in files_to_merge: + merged_content += merge_file.read_text() + merged_content += os.linesep + output_file.write_text(merged_content) if __name__ == "__main__": - main() + merge(DOTENV_FILE, PRODUCTION_DOTENV_FILES) diff --git a/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py new file mode 100644 index 000000000..c0e68f60a --- /dev/null +++ b/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py @@ -0,0 +1,34 @@ +from pathlib import Path + +import pytest + +from merge_production_dotenvs_in_dotenv import merge + + +@pytest.mark.parametrize( + ("input_contents", "expected_output"), + [ + ([], ""), + ([""], "\n"), + (["JANE=doe"], "JANE=doe\n"), + (["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"), + (["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"), + (["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"), + ], +) +def test_merge( + tmp_path: Path, + input_contents: list[str], + expected_output: str, +): + output_file = tmp_path / ".env" + + files_to_merge = [] + for num, input_content in enumerate(input_contents, start=1): + merge_file = tmp_path / f".service{num}" + merge_file.write_text(input_content) + files_to_merge.append(merge_file) + + merge(output_file, files_to_merge) + + assert output_file.read_text() == expected_output From c09fa55b367b11ffcbce7d1875b8aade5b0f9c11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Jan 2023 17:47:29 +0000 Subject: [PATCH 037/385] Auto-update pre-commit hooks (#4108) Co-authored-by: browniebroke --- .pre-commit-config.yaml | 2 +- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca86e7eb5..0617dd66c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index c1aaf0d9f..a273bdf17 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort From fdf9ba27f1a0aa73a7a9686506efcb763ffc9fee Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 28 Jan 2023 13:52:00 -0500 Subject: [PATCH 038/385] Update isort to 5.12.0 (#4109) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ab9c8c8b8..2b7c69d33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ binaryornot==0.4.4 # Code quality # ------------------------------------------------------------------------------ black==22.12.0 -isort==5.11.4 +isort==5.12.0 flake8==6.0.0 flake8-isort==6.0.0 pre-commit==3.0.1 From 8584bafdfed9f5aa31945e4bfd800e664b2a6137 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 29 Jan 2023 02:28:47 +0000 Subject: [PATCH 039/385] Release 2023.01.28 --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a55da25e5..0c317f025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.28 + +### Changed +- Refactor `merge_production_dotenvs_in_dotenv.py` ([#4105](https://github.com/cookiecutter/cookiecutter-django/pull/4105)) +### Updated +- Update isort to 5.12.0 ([#4109](https://github.com/cookiecutter/cookiecutter-django/pull/4109)) +- Auto-update pre-commit hooks ([#4108](https://github.com/cookiecutter/cookiecutter-django/pull/4108)) + ## 2023.01.27 ### Updated diff --git a/setup.py b/setup.py index 5adbbc664..f8321406d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2023.01.27" +version = "2023.01.28" with open("README.rst") as readme_file: long_description = readme_file.read() From 977ffd91a3d389bda19d680ed26f24b63c341fe2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 29 Jan 2023 11:45:13 +0000 Subject: [PATCH 040/385] Remove BrokenLinkEmailsMiddleware (#4112) --- {{cookiecutter.project_slug}}/config/settings/base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 44b03fa03..3d93ffb43 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -152,7 +152,6 @@ MIDDLEWARE = [ "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", - "django.middleware.common.BrokenLinkEmailsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", ] From cbb0e19de75eed12cfa84ca4e6d6e8a34ebe926e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 29 Jan 2023 12:12:12 +0000 Subject: [PATCH 041/385] Add Webpack support (#3623) * Add support for Webpack as frontend pipeline * Rename CI jobs * Fix a couple of issues with Webpack + Docker * Don't include Boostrap CSS from CDN with Webpack * Rename variable * Set publicPath in prod webpack config * Fix removal of SASS files in post-gen hooks * Add Webpack to readme usage section * Run Django + Webpack dev server concurrently without Docker * Fix async runserver command with Gulp/Webpack * Upgrade django-webpack-loader to 1.5.0 * Pass variables required by Webpack at build time * Upgrade django-webpack-loader to 1.7.0 * Add missing condition * Add support for Azure Storage + Webpack * Whitespaces * Rename ROOT_DIR -> BASE_DIR * Rename jobs * Bump django-webpack-loader to latest * Document limitation of Docker + Webpack + no Whitenoise * Update section on custom Bootstrap compilation in generated readme --- .github/workflows/ci.yml | 22 ++-- README.md | 3 +- cookiecutter.json | 3 +- docs/deployment-on-heroku.rst | 8 +- docs/deployment-with-docker.rst | 26 ++++ docs/developing-locally.rst | 2 +- docs/project-generation-options.rst | 6 +- docs/troubleshooting.rst | 12 +- hooks/post_gen_project.py | 111 +++++++++++++++++- tests/test_bare.sh | 6 +- tests/test_cookiecutter_generation.py | 1 + tests/test_docker.sh | 6 + {{cookiecutter.project_slug}}/.gitignore | 4 + .../docker_compose_up_django.xml | 2 +- .../.idea/{{cookiecutter.project_slug}}.iml | 2 +- {{cookiecutter.project_slug}}/README.md | 7 +- .../compose/production/django/Dockerfile | 18 ++- .../config/settings/base.py | 16 +++ .../config/settings/local.py | 8 +- {{cookiecutter.project_slug}}/gulpfile.js | 4 +- {{cookiecutter.project_slug}}/local.yml | 4 +- {{cookiecutter.project_slug}}/package.json | 29 ++++- {{cookiecutter.project_slug}}/production.yml | 13 ++ .../requirements/base.txt | 7 +- .../webpack/common.config.js | 55 +++++++++ .../webpack/dev.config.js | 20 ++++ .../webpack/prod.config.js | 28 +++++ .../static/js/project.js | 4 + .../static/js/vendors.js | 2 + .../static/sass/project.scss | 2 +- .../templates/base.html | 17 ++- 31 files changed, 399 insertions(+), 49 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/webpack/common.config.js create mode 100644 {{cookiecutter.project_slug}}/webpack/dev.config.js create mode 100644 {{cookiecutter.project_slug}}/webpack/prod.config.js create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/vendors.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d466f4032..08ac54d86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - windows-latest - macOS-latest - name: "Run tests" + name: "pytest ${{ matrix.os }}" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -49,10 +49,14 @@ jobs: script: - name: Basic args: "" - - name: Extended - args: "use_celery=y use_drf=y frontend_pipeline=Gulp" + - name: Celery & DRF + args: "use_celery=y use_drf=y" + - name: Gulp + args: "frontend_pipeline=Gulp" + - name: Webpack + args: "frontend_pipeline=Webpack" - name: "${{ matrix.script.name }} Docker" + name: "Docker ${{ matrix.script.name }}" runs-on: ubuntu-latest env: DOCKER_BUILDKIT: 1 @@ -74,12 +78,14 @@ jobs: fail-fast: false matrix: script: - - name: With Celery + - name: Celery args: "use_celery=y frontend_pipeline='Django Compressor'" - - name: With Gulp - args: "frontend_pipeline='Gulp'" + - name: Gulp + args: "frontend_pipeline=Gulp" + - name: Webpack + args: "frontend_pipeline=Webpack" - name: "${{ matrix.script.name }} Bare metal" + name: "Bare metal ${{ matrix.script.name }}" runs-on: ubuntu-latest services: redis: diff --git a/README.md b/README.md index d8fc58ec4..0697862c5 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ production-ready Django projects quickly. - Registration via [django-allauth](https://github.com/pennersr/django-allauth) - Comes with custom user model ready to go - Optional basic ASGI setup for Websockets -- Optional custom static build using Gulp and livereload +- Optional custom static build using Gulp or Webpack - Send emails via [Anymail](https://github.com/anymail/django-anymail) (using [Mailgun](http://www.mailgun.com/) by default or Amazon SES if AWS is selected cloud provider, but switchable) - Media storage using Amazon S3, Google Cloud Storage or Azure Storage - Docker support using [docker-compose](https://github.com/docker/compose) for development and production (using [Traefik](https://traefik.io/) with [LetsEncrypt](https://letsencrypt.org/) support) @@ -149,6 +149,7 @@ Answer the prompts with your own desired [options](http://cookiecutter-django.re 1 - None 2 - Django Compressor 3 - Gulp + 4 - Webpack Choose from 1, 2, 3, 4 [1]: 1 use_celery [n]: y use_mailhog [n]: n diff --git a/cookiecutter.json b/cookiecutter.json index 970411013..cf4da9a45 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -46,7 +46,8 @@ "frontend_pipeline": [ "None", "Django Compressor", - "Gulp" + "Gulp", + "Webpack" ], "use_celery": "n", "use_mailhog": "n", diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index 71fb45dda..71c6e11b2 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -109,10 +109,10 @@ Or add the DSN for your account, if you already have one: .. _Sentry add-on: https://elements.heroku.com/addons/sentry -Gulp & Bootstrap compilation -++++++++++++++++++++++++++++ +Gulp or Webpack ++++++++++++++++ -If you've opted for Gulp, you'll most likely need to setup +If you've opted for Gulp or Webpack as frontend pipeline, you'll most likely need to setup your app to use `multiple buildpacks`_: one for Python & one for Node.js: .. code-block:: bash @@ -121,7 +121,7 @@ your app to use `multiple buildpacks`_: one for Python & one for Node.js: At time of writing, this should do the trick: during deployment, the Heroku should run ``npm install`` and then ``npm build``, -which runs Gulp in cookiecutter-django. +which run the SASS compilation & JS bundling. If things don't work, please refer to the Heroku docs. diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index fcce7e6f5..a431679bf 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -84,6 +84,32 @@ You can read more about this feature and how to configure it, at `Automatic HTTP .. _Automatic HTTPS: https://docs.traefik.io/https/acme/ +.. _webpack-whitenoise-limitation: + +Webpack without Whitenoise limitation +------------------------------------- + +If you opt for Webpack without Whitenoise, Webpack needs to know the static URL at build time, when running ``docker-compose build`` (See ``webpack/prod.config.js``). Depending on your setup, this URL may come from the following environment variables: + +- ``AWS_STORAGE_BUCKET_NAME`` +- ``DJANGO_AWS_S3_CUSTOM_DOMAIN`` +- ``DJANGO_GCP_STORAGE_BUCKET_NAME`` +- ``DJANGO_AZURE_CONTAINER_NAME`` + +The Django settings are getting these values at runtime via the ``.envs/.production/.django`` file , but Docker does not read this file at build time, it only look for a ``.env`` in the root of the project. Failing to pass the values correctly will result in a page without CSS styles nor javascript. + +To solve this, you can either: + +1. merge all the env files into ``.env`` by running:: + + merge_production_dotenvs_in_dotenv.py + +2. create a ``.env`` file in the root of the project with just variables you need. You'll need to also define them in ``.envs/.production/.django`` (hence duplicating them). +3. set these variables when running the build command:: + + DJANGO_AWS_S3_CUSTOM_DOMAIN=example.com docker-compose -f production.yml build``. + +None of these options are ideal, we're open to suggestions on how to improve this. If you think you have one, please open an issue or a pull request. (Optional) Postgres Data Volume Modifications --------------------------------------------- diff --git a/docs/developing-locally.rst b/docs/developing-locally.rst index 2b9438059..fb66536fc 100644 --- a/docs/developing-locally.rst +++ b/docs/developing-locally.rst @@ -172,7 +172,7 @@ You can also use Django admin to queue up tasks, thanks to the `django-celerybea Sass Compilation & Live Reloading --------------------------------- -If you've opted for Gulp as front-end pipeline, the project comes configured with `Sass`_ compilation and `live reloading`_. As you change you Sass/JS source files, the task runner will automatically rebuild the corresponding CSS and JS assets and reload them in your browser without refreshing the page. +If you've opted for Gulp or Webpack as front-end pipeline, the project comes configured with `Sass`_ compilation and `live reloading`_. As you change you Sass/JS source files, the task runner will automatically rebuild the corresponding CSS and JS assets and reload them in your browser without refreshing the page. #. Make sure that `Node.js`_ v16 is installed on your machine. #. In the project root, install the JS dependencies with:: diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 0560badd3..d4ad8a9aa 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -95,7 +95,10 @@ frontend_pipeline: 1. None 2. `Django Compressor`_ - 3. `Gulp`_: support Bootstrap recompilation with real-time variables alteration. + 3. `Gulp`_ + 4. `Webpack`_ + +Both Gulp and Webpack support Bootstrap recompilation with real-time variables alteration. use_celery: Indicates whether the project should be configured to use Celery_. @@ -145,6 +148,7 @@ debug: .. _PostgreSQL: https://www.postgresql.org/docs/ .. _Gulp: https://github.com/gulpjs/gulp +.. _Webpack: https://webpack.js.org .. _AWS: https://aws.amazon.com/s3/ .. _GCP: https://cloud.google.com/storage/ diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index ba8ab53e6..293e9b652 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -1,5 +1,5 @@ Troubleshooting -===================================== +=============== This page contains some advice about errors and problems commonly encountered during the development of Cookiecutter Django applications. @@ -38,6 +38,16 @@ To fix this, you can either: .. _rm: https://docs.docker.com/engine/reference/commandline/volume_rm/ .. _prune: https://docs.docker.com/v17.09/engine/reference/commandline/system_prune/ +Variable is not set. Defaulting to a blank string +------------------------------------------------- + +Example:: + + WARN[0000] The "DJANGO_AWS_STORAGE_BUCKET_NAME" variable is not set. Defaulting to a blank string. + WARN[0000] The "DJANGO_AWS_S3_CUSTOM_DOMAIN" variable is not set. Defaulting to a blank string. + +You have probably opted for Docker + Webpack without Whitenoise. This is a know limitation of the combination, which needs a little bit of manual intervention. See the :ref:`dedicated section about it `. + Others ------ diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 5655b61f9..b64bbbafd 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -10,6 +10,7 @@ TODO: restrict Cookiecutter Django project initialization to """ from __future__ import print_function +import json import os import random import shutil @@ -87,15 +88,30 @@ def remove_heroku_build_hooks(): shutil.rmtree("bin") +def remove_sass_files(): + shutil.rmtree(os.path.join("{{cookiecutter.project_slug}}", "static", "sass")) + + def remove_gulp_files(): file_names = ["gulpfile.js"] for file_name in file_names: os.remove(file_name) - remove_sass_files() -def remove_sass_files(): - shutil.rmtree(os.path.join("{{cookiecutter.project_slug}}", "static", "sass")) +def remove_webpack_files(): + shutil.rmtree("webpack") + remove_vendors_js() + + +def remove_vendors_js(): + vendors_js_path = os.path.join( + "{{ cookiecutter.project_slug }}", + "static", + "js", + "vendors.js", + ) + if os.path.exists(vendors_js_path): + os.remove(vendors_js_path) def remove_packagejson_file(): @@ -104,6 +120,83 @@ def remove_packagejson_file(): os.remove(file_name) +def update_package_json(remove_dev_deps=None, remove_keys=None, scripts=None): + remove_dev_deps = remove_dev_deps or [] + remove_keys = remove_keys or [] + scripts = scripts or {} + with open("package.json", mode="r") as fd: + content = json.load(fd) + for package_name in remove_dev_deps: + content["devDependencies"].pop(package_name) + for key in remove_keys: + content.pop(key) + content["scripts"].update(scripts) + with open("package.json", mode="w") as fd: + json.dump(content, fd, ensure_ascii=False, indent=2) + fd.write("\n") + + +def handle_js_runner(choice, use_docker, use_async): + if choice == "Gulp": + update_package_json( + remove_dev_deps=[ + "@babel/core", + "@babel/preset-env", + "babel-loader", + "concurrently", + "css-loader", + "mini-css-extract-plugin", + "postcss-loader", + "postcss-preset-env", + "sass-loader", + "webpack", + "webpack-bundle-tracker", + "webpack-cli", + "webpack-dev-server", + "webpack-merge", + ], + remove_keys=["babel"], + scripts={ + "dev": "gulp", + "build": "gulp generate-assets", + }, + ) + remove_webpack_files() + elif choice == "Webpack": + scripts = { + "dev": "webpack serve --config webpack/dev.config.js", + "build": "webpack --config webpack/prod.config.js", + } + remove_dev_deps = [ + "browser-sync", + "cssnano", + "gulp", + "gulp-imagemin", + "gulp-plumber", + "gulp-postcss", + "gulp-rename", + "gulp-sass", + "gulp-uglify-es", + ] + if not use_docker: + dev_django_cmd = ( + "uvicorn config.asgi:application --reload" + if use_async + else "python manage.py runserver_plus" + ) + scripts.update( + { + "dev": "concurrently npm:dev:*", + "dev:webpack": "webpack serve --config webpack/dev.config.js", + "dev:django": dev_django_cmd, + } + ) + else: + remove_dev_deps.append("concurrently") + update_package_json(remove_dev_deps=remove_dev_deps, scripts=scripts) + remove_gulp_files() + + def remove_celery_files(): file_names = [ os.path.join("config", "celery_app.py"), @@ -384,13 +477,21 @@ def main(): if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y": append_to_gitignore_file("!.envs/.local/") - if "{{ cookiecutter.frontend_pipeline }}" != "Gulp": + if "{{ cookiecutter.frontend_pipeline }}" in ["None", "Django Compressor"]: remove_gulp_files() + remove_webpack_files() + remove_sass_files() remove_packagejson_file() if "{{ cookiecutter.use_docker }}".lower() == "y": remove_node_dockerfile() + else: + handle_js_runner( + "{{ cookiecutter.frontend_pipeline }}", + use_docker=("{{ cookiecutter.use_docker }}".lower() == "y"), + use_async=("{{ cookiecutter.use_async }}".lower() == "y"), + ) - if "{{ cookiecutter.cloud_provider}}" == "None": + if "{{ cookiecutter.cloud_provider }}" == "None": print( WARNING + "You chose not to use a cloud provider, " "media files won't be served in production." + TERMINATOR diff --git a/tests/test_bare.sh b/tests/test_bare.sh index 05da9328b..afd12fec8 100755 --- a/tests/test_bare.sh +++ b/tests/test_bare.sh @@ -32,13 +32,11 @@ pytest # Make sure the check doesn't raise any warnings python manage.py check --fail-level WARNING +# Run npm build script if package.json is present if [ -f "package.json" ] then npm install - if [ -f "gulpfile.js" ] - then - npm run build - fi + npm run build fi # Generate the HTML for the documentation diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 3a881cc64..5608bf884 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -101,6 +101,7 @@ SUPPORTED_COMBINATIONS = [ {"frontend_pipeline": "None"}, {"frontend_pipeline": "Django Compressor"}, {"frontend_pipeline": "Gulp"}, + {"frontend_pipeline": "Webpack"}, {"use_celery": "y"}, {"use_celery": "n"}, {"use_mailhog": "y"}, diff --git a/tests/test_docker.sh b/tests/test_docker.sh index b3663bd2c..28d232896 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -41,3 +41,9 @@ docker-compose -f local.yml run django python manage.py check --fail-level WARNI # Generate the HTML for the documentation docker-compose -f local.yml run docs make html + +# Run npm build script if package.json is present +if [ -f "package.json" ] +then + docker-compose -f local.yml run node npm run build +fi diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 17e9249c0..19bb2bc07 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -348,3 +348,7 @@ vendors.js *.min.js *.min.js.map {%- endif %} +{%- if cookiecutter.frontend_pipeline == 'Webpack' %} +{{ cookiecutter.project_slug }}/static/webpack_bundles/ +webpack-stats.json +{%- endif %} diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/docker_compose_up_django.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/docker_compose_up_django.xml index ad3b6a35a..e84c5ffdd 100644 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/docker_compose_up_django.xml +++ b/{{cookiecutter.project_slug}}/.idea/runConfigurations/docker_compose_up_django.xml @@ -10,7 +10,7 @@