diff --git a/.github/contributors.json b/.github/contributors.json index 6ee792c5b..15d481a4d 100644 --- a/.github/contributors.json +++ b/.github/contributors.json @@ -1262,5 +1262,30 @@ "name": "Naveen", "github_login": "naveensrinivasan", "twitter_username": "snaveen" + }, + { + "name": "Nikita Sobolev", + "github_login": "sobolevn", + "twitter_username": "" + }, + { + "name": "Sebastian Reyes Espinosa", + "github_login": "sebastian-code", + "twitter_username": "sebastianreyese" + }, + { + "name": "jugglinmike", + "github_login": "jugglinmike", + "twitter_username": "" + }, + { + "name": "monosans", + "github_login": "monosans", + "twitter_username": "" + }, + { + "name": "Marcio Mazza", + "github_login": "marciomazza", + "twitter_username": "marciomazza" } ] \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7c525794..4bed79641 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,14 +9,14 @@ repos: - id: check-yaml - repo: https://github.com/asottile/pyupgrade - rev: v2.34.0 + rev: v2.37.3 hooks: - id: pyupgrade args: [--py39-plus] exclude: hooks/ - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 22.8.0 hooks: - id: black @@ -26,7 +26,7 @@ repos: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 13cb3b757..193ef9228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,129 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2022.09.05 + +### Updated +- Update sentry-sdk to 1.9.8 ([#3861](https://github.com/cookiecutter/cookiecutter-django/pull/3861)) + +## 2022.09.02 + +### Updated +- Update pytest to 7.1.3 ([#3860](https://github.com/cookiecutter/cookiecutter-django/pull/3860)) +- Update sentry-sdk to 1.9.7 ([#3859](https://github.com/cookiecutter/cookiecutter-django/pull/3859)) + +## 2022.09.01 + +### Changed +- Add article to README about how to use a hosted DB ([#3844](https://github.com/cookiecutter/cookiecutter-django/pull/3844)) +### Updated +- Update sentry-sdk to 1.9.6 ([#3856](https://github.com/cookiecutter/cookiecutter-django/pull/3856)) +- Auto-update pre-commit hooks ([#3858](https://github.com/cookiecutter/cookiecutter-django/pull/3858)) +- Update black to 22.8.0 ([#3857](https://github.com/cookiecutter/cookiecutter-django/pull/3857)) + +## 2022.08.26 + +### Changed +- Fix formatting in docs ([#3850](https://github.com/cookiecutter/cookiecutter-django/pull/3850)) + +## 2022.08.24 + +### Updated +- Update django-debug-toolbar to 3.6.0 ([#3847](https://github.com/cookiecutter/cookiecutter-django/pull/3847)) +- Update werkzeug to 2.2.2 ([#3846](https://github.com/cookiecutter/cookiecutter-django/pull/3846)) +- Update coverage to 6.4.4 ([#3842](https://github.com/cookiecutter/cookiecutter-django/pull/3842)) +- Update uvicorn to 0.18.3 ([#3845](https://github.com/cookiecutter/cookiecutter-django/pull/3845)) +- Update sentry-sdk to 1.9.5 ([#3841](https://github.com/cookiecutter/cookiecutter-django/pull/3841)) +- Update flower to 1.2.0 ([#3836](https://github.com/cookiecutter/cookiecutter-django/pull/3836)) +- Update django-storages to 1.13.1 ([#3833](https://github.com/cookiecutter/cookiecutter-django/pull/3833)) + +## 2022.08.15 + +### Updated +- Update coverage to 6.4.3 ([#3835](https://github.com/cookiecutter/cookiecutter-django/pull/3835)) +- Update pytz to 2022.2.1 ([#3840](https://github.com/cookiecutter/cookiecutter-django/pull/3840)) +- Update sentry-sdk to 1.9.4 ([#3838](https://github.com/cookiecutter/cookiecutter-django/pull/3838)) + +## 2022.08.09 + +### Updated +- Update sentry-sdk to 1.9.3 ([#3837](https://github.com/cookiecutter/cookiecutter-django/pull/3837)) + +## 2022.08.05 + +### Updated +- Update sentry-sdk to 1.9.2 ([#3832](https://github.com/cookiecutter/cookiecutter-django/pull/3832)) + +## 2022.08.04 + +### Updated +- Auto-update pre-commit hooks ([#3816](https://github.com/cookiecutter/cookiecutter-django/pull/3816)) +- Update flake8 to 5.0.4 ([#3829](https://github.com/cookiecutter/cookiecutter-django/pull/3829)) +- Update django-compressor to 4.1 ([#3823](https://github.com/cookiecutter/cookiecutter-django/pull/3823)) +- Update flake8-isort to 4.2.0 ([#3828](https://github.com/cookiecutter/cookiecutter-django/pull/3828)) + +## 2022.08.03 + +### Updated +- Update django to 3.2.15 ([#3822](https://github.com/cookiecutter/cookiecutter-django/pull/3822)) + +## 2022.07.29 + +### Updated +- Update sentry-sdk to 1.9.0 ([#3815](https://github.com/cookiecutter/cookiecutter-django/pull/3815)) + +## 2022.07.28 + +### Updated +- Update werkzeug to 2.2.1 ([#3814](https://github.com/cookiecutter/cookiecutter-django/pull/3814)) + +## 2022.07.27 + +### Updated +- Update werkzeug to 2.2.0 ([#3813](https://github.com/cookiecutter/cookiecutter-django/pull/3813)) +- Update sphinx to 5.1.1 ([#3811](https://github.com/cookiecutter/cookiecutter-django/pull/3811)) +- Update drf-spectacular to 0.23.1 ([#3812](https://github.com/cookiecutter/cookiecutter-django/pull/3812)) + +## 2022.07.26 + +### Changed +- Switch from `watchgod` to `watchfiles` ([#3791](https://github.com/cookiecutter/cookiecutter-django/pull/3791)) +- Change Django settings file used by pylint ([#3806](https://github.com/cookiecutter/cookiecutter-django/pull/3806)) +- Simplify database access in tests ([#3807](https://github.com/cookiecutter/cookiecutter-django/pull/3807)) +- Provide more context when wating for PostgreSQL takes too long ([#3782](https://github.com/cookiecutter/cookiecutter-django/pull/3782)) +### Updated +- Update django-compressor to 4.0 ([#3802](https://github.com/cookiecutter/cookiecutter-django/pull/3802)) +- Update flake8-isort to 4.1.2.post0 ([#3809](https://github.com/cookiecutter/cookiecutter-django/pull/3809)) +- Update sphinx to 5.1.0 ([#3808](https://github.com/cookiecutter/cookiecutter-django/pull/3808)) +- Update sh to 1.14.3 ([#3798](https://github.com/cookiecutter/cookiecutter-django/pull/3798)) +- Auto-update pre-commit hooks ([#3780](https://github.com/cookiecutter/cookiecutter-django/pull/3780)) + +## 2022.07.22 + +### Updated +- Update pytest-sugar to 0.9.5 ([#3800](https://github.com/cookiecutter/cookiecutter-django/pull/3800)) +- Update sphinx to 5.0.2 ([#3801](https://github.com/cookiecutter/cookiecutter-django/pull/3801)) +- Update pillow to 9.2.0 ([#3799](https://github.com/cookiecutter/cookiecutter-django/pull/3799)) +- Update werkzeug to 2.1.2 ([#3797](https://github.com/cookiecutter/cookiecutter-django/pull/3797)) + +## 2022.07.21 + +### Changed +- Set user to form instance in update user view test ([#3776](https://github.com/cookiecutter/cookiecutter-django/pull/3776)) +- Fix warning from django-coverage-plugin in tests ([#3790](https://github.com/cookiecutter/cookiecutter-django/pull/3790)) +- Always use `const` instead of `var` in `gulpfile.js` ([#3786](https://github.com/cookiecutter/cookiecutter-django/pull/3786)) +### Updated +- Update flower to 1.1.0 ([#3796](https://github.com/cookiecutter/cookiecutter-django/pull/3796)) +- Update coverage to 6.4.2 ([#3783](https://github.com/cookiecutter/cookiecutter-django/pull/3783)) +- Update mypy to 0.971 ([#3788](https://github.com/cookiecutter/cookiecutter-django/pull/3788)) +- Update sentry-sdk to 1.8.0 ([#3792](https://github.com/cookiecutter/cookiecutter-django/pull/3792)) +- Update pre-commit to 2.20.0 ([#3779](https://github.com/cookiecutter/cookiecutter-django/pull/3779)) +- Update django-extensions to 3.2.0 ([#3774](https://github.com/cookiecutter/cookiecutter-django/pull/3774)) +- Update tox to 3.25.1 ([#3767](https://github.com/cookiecutter/cookiecutter-django/pull/3767)) +- Update uvicorn to 0.18.2 ([#3762](https://github.com/cookiecutter/cookiecutter-django/pull/3762)) +- Update redis to 4.3.4 ([#3763](https://github.com/cookiecutter/cookiecutter-django/pull/3763)) +- Update requests to 2.28.1 ([#3766](https://github.com/cookiecutter/cookiecutter-django/pull/3766)) + ## 2022.07.10 ### Changed diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 90db6689f..0dd360bd3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1006,6 +1006,13 @@ Listed in alphabetical order. + + jugglinmike + + jugglinmike + + + Jules Cheron @@ -1202,6 +1209,13 @@ Listed in alphabetical order. + + Marcio Mazza + + marciomazza + + marciomazza + Martin Blech @@ -1335,6 +1349,13 @@ Listed in alphabetical order. + + monosans + + monosans + + + mozillazg @@ -1363,6 +1384,13 @@ Listed in alphabetical order. moby_dick91 + + Nikita Sobolev + + sobolevn + + + Noah H @@ -1524,6 +1552,13 @@ Listed in alphabetical order. saschalalala + + Sebastian Reyes Espinosa + + sebastian-code + + sebastianreyese + Simon Rey diff --git a/README.md b/README.md index 5fda8ff24..7059e07d2 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,7 @@ experience better. ## Articles +- [Cookiecutter Django With Amazon RDS](https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds/) - Apr, 2, 2021 - [Using cookiecutter-django with Google Cloud Storage](https://ahhda.github.io/cloud/gce/django/2019/03/12/using-django-cookiecutter-cloud-storage.html) - Mar. 12, 2019 - [cookiecutter-django with Nginx, Route 53 and ELB](https://msaizar.com/blog/cookiecutter-django-nginx-route-53-and-elb/) - Feb. 12, 2018 - [cookiecutter-django and Amazon RDS](https://msaizar.com/blog/cookiecutter-django-and-amazon-rds/) - Feb. 7, 2018 diff --git a/docs/faq.rst b/docs/faq.rst index 820fb60fa..52a99467c 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -6,7 +6,7 @@ FAQ Why is there a django.contrib.sites directory in Cookiecutter Django? --------------------------------------------------------------------- -It is there to add a migration so you don't have to manually change the ``sites.Site`` record from ``example.com`` to whatever your domain is. Instead, your ``{{cookiecutter.domain_name}}`` and {{cookiecutter.project_name}} value is placed by **Cookiecutter** in the domain and name fields respectively. +It is there to add a migration so you don't have to manually change the ``sites.Site`` record from ``example.com`` to whatever your domain is. Instead, your ``{{cookiecutter.domain_name}}`` and ``{{cookiecutter.project_name}}`` value is placed by **Cookiecutter** in the domain and name fields respectively. See `0003_set_site_domain_and_name.py`_. diff --git a/docs/requirements.txt b/docs/requirements.txt index b18d014f5..dc8f4c6e9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,2 @@ -sphinx==5.0.1 +sphinx==5.1.1 sphinx-rtd-theme==1.0.0 diff --git a/requirements.txt b/requirements.txt index 66c8ef722..4151bff95 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,19 @@ cookiecutter==2.1.1 -sh==1.14.2 +sh==1.14.3; sys_platform != "win32" binaryornot==0.4.4 # Code quality # ------------------------------------------------------------------------------ -black==22.6.0 +black==22.8.0 isort==5.10.1 -flake8==4.0.1 -flake8-isort==4.1.1 -pre-commit==2.19.0 +flake8==5.0.4 +flake8-isort==4.2.0 +pre-commit==2.20.0 # Testing # ------------------------------------------------------------------------------ -tox==3.25.0 -pytest==7.1.2 +tox==3.25.1 +pytest==7.1.3 pytest-cookies==0.6.1 pytest-instafail==0.4.2 pyyaml==6.0 @@ -23,4 +23,4 @@ pyyaml==6.0 PyGithub==1.55 gitpython==3.1.27 jinja2==3.1.2 -requests==2.28.0 +requests==2.28.1 diff --git a/scripts/create_django_issue.py b/scripts/create_django_issue.py index f1ff51a06..262618531 100644 --- a/scripts/create_django_issue.py +++ b/scripts/create_django_issue.py @@ -11,8 +11,9 @@ from __future__ import annotations import os import re import sys +from collections.abc import Iterable from pathlib import Path -from typing import TYPE_CHECKING, Any, Iterable, NamedTuple +from typing import TYPE_CHECKING, Any, NamedTuple import requests from github import Github diff --git a/scripts/update_changelog.py b/scripts/update_changelog.py index c3c834eef..b50d25066 100644 --- a/scripts/update_changelog.py +++ b/scripts/update_changelog.py @@ -1,8 +1,8 @@ import datetime as dt import os import re +from collections.abc import Iterable from pathlib import Path -from typing import Iterable import git import github.PullRequest diff --git a/setup.py b/setup.py index ff30f8761..a10b51e7f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2022.07.10" +version = "2022.09.05" with open("README.rst") as readme_file: long_description = readme_file.read() diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index cee63c214..ec386b17e 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -10,13 +10,13 @@ repos: - id: check-yaml - repo: https://github.com/asottile/pyupgrade - rev: v2.34.0 + rev: v2.37.3 hooks: - id: pyupgrade args: [--py39-plus] - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 22.8.0 hooks: - id: black @@ -26,7 +26,7 @@ repos: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 args: ["--config=setup.cfg"] diff --git a/{{cookiecutter.project_slug}}/.pylintrc b/{{cookiecutter.project_slug}}/.pylintrc index 6f195c6ef..9d604334b 100644 --- a/{{cookiecutter.project_slug}}/.pylintrc +++ b/{{cookiecutter.project_slug}}/.pylintrc @@ -1,6 +1,6 @@ [MASTER] load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %} -django-settings-module=config.settings.base +django-settings-module=config.settings.local [FORMAT] max-line-length=120 diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start index d7b63cd41..4ddcfa137 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start @@ -4,4 +4,4 @@ set -o errexit set -o nounset -watchgod celery.__main__.main --args -A config.celery_app worker -l INFO +watchfiles celery.__main__.main --args '-A config.celery_app worker -l INFO' diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index 95ab8297a..2fbcad955 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -16,30 +16,34 @@ if [ -z "${POSTGRES_USER}" ]; then fi export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" -postgres_ready() { python << END import sys +import time import psycopg2 -try: - psycopg2.connect( - dbname="${POSTGRES_DB}", - user="${POSTGRES_USER}", - password="${POSTGRES_PASSWORD}", - host="${POSTGRES_HOST}", - port="${POSTGRES_PORT}", - ) -except psycopg2.OperationalError: - sys.exit(-1) -sys.exit(0) +suggest_unrecoverable_after = 30 +start = time.time() +while True: + try: + psycopg2.connect( + dbname="${POSTGRES_DB}", + user="${POSTGRES_USER}", + password="${POSTGRES_PASSWORD}", + host="${POSTGRES_HOST}", + port="${POSTGRES_PORT}", + ) + break + except psycopg2.OperationalError as error: + sys.stderr.write("Waiting for PostgreSQL to become available...\n") + + if time.time() - start > suggest_unrecoverable_after: + sys.stderr.write(" This is taking longer than expected. The following exception may be indicative of an unrecoverable error: '{}'\n".format(error)) + + time.sleep(1) END -} -until postgres_ready; do - >&2 echo 'Waiting for PostgreSQL to become available...' - sleep 1 -done + >&2 echo 'PostgreSQL is available' exec "$@" diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index 78fb6cc66..f103eb10b 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -25,5 +25,9 @@ PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] # https://docs.djangoproject.com/en/dev/ref/settings/#email-backend EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" +# DEBUGING FOR TEMPLATES +# ------------------------------------------------------------------------------ +TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405 + # Your stuff... # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index 628b838ba..680e3672e 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -42,7 +42,7 @@ function pathsConfig(appName) { } } -var paths = pathsConfig() +const paths = pathsConfig() //////////////////////////////// // Tasks @@ -50,12 +50,12 @@ var paths = pathsConfig() // Styles autoprefixing and minification function styles() { - var processCss = [ + const processCss = [ autoprefixer(), // adds vendor prefixes pixrem(), // add fallbacks for rem units ] - var minifyCss = [ + const minifyCss = [ cssnano({ preset: 'default' }) // minify result ] @@ -104,7 +104,7 @@ function imgCompression() { {%- if cookiecutter.use_async == 'y' -%} // Run django server function asyncRunServer() { - var cmd = spawn('gunicorn', [ + const cmd = spawn('gunicorn', [ 'config.asgi', '-k', 'uvicorn.workers.UvicornWorker', '--reload' ], {stdio: 'inherit'} ) @@ -115,7 +115,7 @@ function asyncRunServer() { {%- else %} // Run django server function runServer(cb) { - var cmd = spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'}) + const cmd = spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'}) cmd.on('close', function(code) { console.log('runServer exited with code ' + code) cb(code) diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index 09fedbb3f..d702a5f67 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -1,6 +1,6 @@ import os +from collections.abc import Sequence from pathlib import Path -from typing import Sequence import pytest diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index e540f13fe..966075655 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,6 +1,6 @@ -pytz==2022.1 # https://github.com/stub42/pytz +pytz==2022.2.1 # https://github.com/stub42/pytz python-slugify==6.1.2 # https://github.com/un33k/python-slugify -Pillow==9.1.1 # https://github.com/python-pillow/Pillow +Pillow==9.2.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin @@ -12,7 +12,7 @@ argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==6.2.0 # https://github.com/evansd/whitenoise {%- endif %} -redis==4.3.3 # https://github.com/redis/redis-py +redis==4.3.4 # https://github.com/redis/redis-py {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} hiredis==2.0.0 # https://github.com/redis/hiredis-py {%- endif %} @@ -20,23 +20,23 @@ hiredis==2.0.0 # https://github.com/redis/hiredis-py celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery django-celery-beat==2.3.0 # https://github.com/celery/django-celery-beat {%- if cookiecutter.use_docker == 'y' %} -flower==1.0.0 # https://github.com/mher/flower +flower==1.2.0 # https://github.com/mher/flower {%- endif %} {%- endif %} {%- if cookiecutter.use_async == 'y' %} -uvicorn[standard]==0.17.6 # https://github.com/encode/uvicorn +uvicorn[standard]==0.18.3 # https://github.com/encode/uvicorn {%- endif %} # Django # ------------------------------------------------------------------------------ -django==3.2.14 # pyup: < 4.0 # https://www.djangoproject.com/ +django==3.2.15 # pyup: < 4.0 # https://www.djangoproject.com/ django-environ==0.9.0 # https://github.com/joke2k/django-environ django-model-utils==4.2.0 # https://github.com/jazzband/django-model-utils django-allauth==0.51.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.6 # https://github.com/django-crispy-forms/crispy-bootstrap5 {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} -django-compressor==3.1 # https://github.com/django-compressor/django-compressor +django-compressor==4.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' %} @@ -44,5 +44,5 @@ django-redis==5.2.0 # https://github.com/jazzband/django-redis djangorestframework==3.13.1 # https://github.com/encode/django-rest-framework django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers # DRF-spectacular for api documentation -drf-spectacular==0.22.1 # https://github.com/tfranzel/drf-spectacular +drf-spectacular==0.23.1 # https://github.com/tfranzel/drf-spectacular {%- endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index c11910ec5..1c0dacd38 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,6 +1,6 @@ -r base.txt -Werkzeug[watchdog]==2.0.3 # https://github.com/pallets/werkzeug +Werkzeug[watchdog]==2.2.2 # https://github.com/pallets/werkzeug ipdb==0.13.9 # https://github.com/gotcha/ipdb {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.9.3 # https://github.com/psycopg/psycopg2 @@ -8,41 +8,41 @@ psycopg2==2.9.3 # https://github.com/psycopg/psycopg2 psycopg2-binary==2.9.3 # https://github.com/psycopg/psycopg2 {%- endif %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} -watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod +watchfiles==0.16.1 # https://github.com/samuelcolvin/watchfiles {%- endif %} # Testing # ------------------------------------------------------------------------------ -mypy==0.950 # https://github.com/python/mypy +mypy==0.971 # https://github.com/python/mypy django-stubs==1.12.0 # https://github.com/typeddjango/django-stubs -pytest==7.1.2 # https://github.com/pytest-dev/pytest -pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar +pytest==7.1.3 # https://github.com/pytest-dev/pytest +pytest-sugar==0.9.5 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} djangorestframework-stubs==1.7.0 # https://github.com/typeddjango/djangorestframework-stubs {%- endif %} # Documentation # ------------------------------------------------------------------------------ -sphinx==5.0.1 # https://github.com/sphinx-doc/sphinx +sphinx==5.1.1 # https://github.com/sphinx-doc/sphinx sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild # Code quality # ------------------------------------------------------------------------------ -flake8==4.0.1 # https://github.com/PyCQA/flake8 -flake8-isort==4.1.1 # https://github.com/gforcada/flake8-isort -coverage==6.4.1 # https://github.com/nedbat/coveragepy -black==22.6.0 # https://github.com/psf/black +flake8==5.0.4 # https://github.com/PyCQA/flake8 +flake8-isort==4.2.0 # https://github.com/gforcada/flake8-isort +coverage==6.4.4 # https://github.com/nedbat/coveragepy +black==22.8.0 # https://github.com/psf/black 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.19.0 # https://github.com/pre-commit/pre-commit +pre-commit==2.20.0 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ factory-boy==3.2.1 # https://github.com/FactoryBoy/factory_boy -django-debug-toolbar==3.5.0 # https://github.com/jazzband/django-debug-toolbar -django-extensions==3.1.5 # https://github.com/django-extensions/django-extensions +django-debug-toolbar==3.6.0 # https://github.com/jazzband/django-debug-toolbar +django-extensions==3.2.0 # https://github.com/django-extensions/django-extensions django-coverage-plugin==2.0.3 # https://github.com/nedbat/django_coverage_plugin pytest-django==4.5.2 # https://github.com/pytest-dev/pytest-django diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 7b10184db..371f81cbc 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.9.3 # https://github.com/psycopg/psycopg2 Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==1.6.0 # https://github.com/getsentry/sentry-python +sentry-sdk==1.9.8 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} hiredis==2.0.0 # https://github.com/redis/hiredis-py @@ -17,9 +17,9 @@ hiredis==2.0.0 # https://github.com/redis/hiredis-py # Django # ------------------------------------------------------------------------------ {%- if cookiecutter.cloud_provider == 'AWS' %} -django-storages[boto3]==1.12.3 # https://github.com/jschneier/django-storages +django-storages[boto3]==1.13.1 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'GCP' %} -django-storages[google]==1.12.3 # https://github.com/jschneier/django-storages +django-storages[google]==1.13.1 # https://github.com/jschneier/django-storages {%- endif %} {%- if cookiecutter.mail_service == 'Mailgun' %} django-anymail[mailgun]==8.6 # https://github.com/anymail/django-anymail diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index 425359e69..c6f7782f6 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.9.9 +python-3.9.13 diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py index 335648e07..7095a4714 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py @@ -10,5 +10,5 @@ def media_storage(settings, tmpdir): @pytest.fixture -def user() -> User: +def user(db) -> User: return UserFactory() diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py index edd306cb8..e30476227 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py @@ -1,4 +1,5 @@ -from typing import Any, Sequence +from collections.abc import Sequence +from typing import Any from django.contrib.auth import get_user_model from factory import Faker, post_generation diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py index c50a4be4c..a370784fc 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py @@ -1,10 +1,7 @@ -import pytest from django.urls import reverse from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - class TestUserAdmin: def test_changelist(self, admin_client): diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py index 83b623f45..7d9c444d3 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py @@ -1,10 +1,7 @@ -import pytest from django.urls import resolve, reverse from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - def test_user_detail(user: User): assert ( diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py index 924573089..4d163bf08 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py @@ -1,11 +1,8 @@ -import pytest from django.test import RequestFactory from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - class TestUserViewSet: def test_get_queryset(self, user: User, rf: RequestFactory): diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py index e51bb6bf2..261f88c8c 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py @@ -1,14 +1,11 @@ """ Module for all Form Tests. """ -import pytest from django.utils.translation import gettext_lazy as _ from {{ cookiecutter.project_slug }}.users.forms import UserAdminCreationForm from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - class TestUserAdminCreationForm: """ diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py index 3194be1fd..b09bcdf0b 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py @@ -1,9 +1,5 @@ -import pytest - from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - def test_user_get_absolute_url(user: User): assert user.get_absolute_url() == f"/users/{user.username}/" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py index 7f5b75844..f97658b55 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py @@ -1,8 +1,6 @@ import pytest from django.urls import reverse -pytestmark = pytest.mark.django_db - def test_swagger_accessible_by_admin(admin_client): url = reverse("api-docs") @@ -10,6 +8,7 @@ def test_swagger_accessible_by_admin(admin_client): assert response.status_code == 200 +@pytest.mark.django_db def test_swagger_ui_not_accessible_by_normal_user(client): url = reverse("api-docs") response = client.get(url) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index aab6d0a87..7cd056db5 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -1,10 +1,7 @@ -import pytest from django.urls import resolve, reverse from {{ cookiecutter.project_slug }}.users.models import User -pytestmark = pytest.mark.django_db - def test_detail(user: User): assert ( diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py index 0b47bd79f..d968d7ec9 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py @@ -64,6 +64,7 @@ class TestUserUpdateView: # Initialize the form form = UserAdminChangeForm() form.cleaned_data = {} + form.instance = user view.form_valid(form) messages_sent = [m.message for m in messages.get_messages(request)]