Merge branch 'master' into master

This commit is contained in:
Bruno Alla 2023-02-25 12:12:23 +00:00 committed by GitHub
commit 9efed2ee70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 245 additions and 64 deletions

View File

@ -1357,5 +1357,20 @@
"name": "tildebox",
"github_login": "tildebox",
"twitter_username": ""
},
{
"name": "duffn",
"github_login": "duffn",
"twitter_username": ""
},
{
"name": "Delphine LEMIRE",
"github_login": "DelphineLemire",
"twitter_username": ""
},
{
"name": "Hoai-Thu Vuong",
"github_login": "thuvh",
"twitter_username": ""
}
]

View File

@ -18,3 +18,56 @@ updates:
interval: "daily"
labels:
- "update"
# Enable version updates for Docker
# We need to specify each Dockerfile in a separate entry because Dependabot doesn't
# support wildcards or recursively checking subdirectories. Check this issue for updates:
# https://github.com/dependabot/dependabot-core/issues/2178
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/local/django/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/local/docs/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/local/node/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/production/aws/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/production/django/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/production/postgres/"
schedule:
interval: "daily"
labels:
- "update"
- package-ecosystem: "docker"
directory: "{{cookiecutter.project_slug}}/compose/production/traefik/"
schedule:
interval: "daily"
labels:
- "update"

View File

@ -2,6 +2,7 @@ name: CI
on:
push:
branches: [ "master", "main" ]
pull_request:
concurrency:
@ -9,17 +10,6 @@ concurrency:
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
tests:
strategy:
fail-fast: false

View File

@ -16,7 +16,7 @@ repos:
exclude: hooks/
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

View File

@ -3,6 +3,73 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER -->
## 2023.02.17
### Changed
- Update version of github actions on the template project ([#4167](https://github.com/cookiecutter/cookiecutter-django/pull/4167))
## 2023.02.09
### Changed
- Remove unused pip cache paths in GHA &amp; add a note for pre-commit.ci ([#4151](https://github.com/cookiecutter/cookiecutter-django/pull/4151))
### Updated
- Update mypy to 0.991 ([#4106](https://github.com/cookiecutter/cookiecutter-django/pull/4106))
## 2023.02.08
### Updated
- Update sphinx to 6.1.3 ([#4148](https://github.com/cookiecutter/cookiecutter-django/pull/4148))
- Update redis to 4.5.1 ([#4147](https://github.com/cookiecutter/cookiecutter-django/pull/4147))
## 2023.02.07
### Updated
- Bump postcss-preset-env from 7.8.3 to 8.0.1 ([#4115](https://github.com/cookiecutter/cookiecutter-django/pull/4115))
- Bump sass-loader from 12.6.0 to 13.2.0 ([#4116](https://github.com/cookiecutter/cookiecutter-django/pull/4116))
- Bump babel-loader from 8.3.0 to 9.1.2 ([#4117](https://github.com/cookiecutter/cookiecutter-django/pull/4117))
- Bump postcss-loader from 6.2.1 to 7.0.2 ([#4114](https://github.com/cookiecutter/cookiecutter-django/pull/4114))
- Bump webpack-cli from 4.10.0 to 5.0.1 ([#4118](https://github.com/cookiecutter/cookiecutter-django/pull/4118))
- Update redis to 4.5.0 ([#4142](https://github.com/cookiecutter/cookiecutter-django/pull/4142))
- Update sentry-sdk to 1.15.0 ([#4141](https://github.com/cookiecutter/cookiecutter-django/pull/4141))
## 2023.02.06
### Changed
- Change `RequestFactory` to `APIRequestFactory` in tests for API views ([#4110](https://github.com/cookiecutter/cookiecutter-django/pull/4110))
### Fixed
- Fix django-webpack-loader setup when running tests ([#4128](https://github.com/cookiecutter/cookiecutter-django/pull/4128))
### Documentation
- Added AWS ECS Full Deployment Article to README ([#2630](https://github.com/cookiecutter/cookiecutter-django/pull/2630))
### Updated
- Update hiredis to 2.2.1 ([#4123](https://github.com/cookiecutter/cookiecutter-django/pull/4123))
- Update tox to 4.4.4 ([#4133](https://github.com/cookiecutter/cookiecutter-django/pull/4133))
- Update django to 4.0.9 ([#4134](https://github.com/cookiecutter/cookiecutter-django/pull/4134))
- Update django-webpack-loader to 1.8.1 ([#4132](https://github.com/cookiecutter/cookiecutter-django/pull/4132))
## 2023.02.05
### Documentation
- Add note about which service to request when running locally with Docker &amp; Webpack or Gulp ([#4130](https://github.com/cookiecutter/cookiecutter-django/pull/4130))
## 2023.02.03
### Updated
- Update pre-commit to 3.0.4 ([#4127](https://github.com/cookiecutter/cookiecutter-django/pull/4127))
## 2023.02.02
### Updated
- Update python-slugify to 8.0.0 ([#4111](https://github.com/cookiecutter/cookiecutter-django/pull/4111))
- Update pre-commit to 3.0.3 ([#4121](https://github.com/cookiecutter/cookiecutter-django/pull/4121))
- Update black to 23.1.0 ([#4120](https://github.com/cookiecutter/cookiecutter-django/pull/4120))
- Update black pre-commit hook ([#4122](https://github.com/cookiecutter/cookiecutter-django/pull/4122))
## 2023.01.29
### Changed
- Add Webpack support ([#3623](https://github.com/cookiecutter/cookiecutter-django/pull/3623))
- Remove `BrokenLinkEmailsMiddleware` ([#4112](https://github.com/cookiecutter/cookiecutter-django/pull/4112))
## 2023.01.28
### Changed

View File

@ -642,6 +642,13 @@ Listed in alphabetical order.
</td>
<td>jangeador</td>
</tr>
<tr>
<td>Delphine LEMIRE</td>
<td>
<a href="https://github.com/DelphineLemire">DelphineLemire</a>
</td>
<td></td>
</tr>
<tr>
<td>Demetris Stavrou</td>
<td>
@ -705,6 +712,13 @@ Listed in alphabetical order.
</td>
<td>dudanogueira</td>
</tr>
<tr>
<td>duffn</td>
<td>
<a href="https://github.com/duffn">duffn</a>
</td>
<td></td>
</tr>
<tr>
<td>Dónal Adams</td>
<td>
@ -901,6 +915,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>Hoai-Thu Vuong</td>
<td>
<a href="https://github.com/thuvh">thuvh</a>
</td>
<td></td>
</tr>
<tr>
<td>Howie Zhao</td>
<td>

View File

@ -2,10 +2,12 @@
[![Build Status](https://img.shields.io/github/actions/workflow/status/cookiecutter/cookiecutter-django/ci.yml?branch=master)](https://github.com/cookiecutter/cookiecutter-django/actions/workflows/ci.yml?query=branch%3Amaster)
[![Documentation Status](https://readthedocs.org/projects/cookiecutter-django/badge/?version=latest)](https://cookiecutter-django.readthedocs.io/en/latest/?badge=latest)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/cookiecutter/cookiecutter-django/master.svg)](https://results.pre-commit.ci/latest/github/cookiecutter/cookiecutter-django/master)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Updates](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/shield.svg)](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/)
[![Join our Discord](https://img.shields.io/badge/Discord-cookiecutter-5865F2?style=flat&logo=discord&logoColor=white)](https://discord.gg/uFXweDQc5a)
[![Code Helpers Badge](https://www.codetriage.com/cookiecutter/cookiecutter-django/badges/users.svg)](https://www.codetriage.com/cookiecutter/cookiecutter-django)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
Powered by [Cookiecutter](https://github.com/cookiecutter/cookiecutter), Cookiecutter Django is a framework for jumpstarting
production-ready Django projects quickly.
@ -234,6 +236,7 @@ experience better.
## Articles
- [Cookiecutter Django With Amazon RDS](https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds/) - Apr, 2, 2021
- [Complete Walkthrough: Blue/Green Deployment to AWS ECS using GitHub actions](https://github.com/Andrew-Chen-Wang/cookiecutter-django-ecs-github) - June 10, 2020
- [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

View File

@ -213,6 +213,11 @@ By default, it's enabled both in local and production environments (``local.yml`
.. _`Flower`: https://github.com/mher/flower
Using Webpack or Gulp
~~~~~~~~~~~~~~~~~~~~~
When using Webpack or Gulp as the ``frontend_pipeline`` option, you should access your application at the address of the ``node`` service in order to see your correct styles. This is http://localhost:3000 by default. When using any of the other ``frontend_pipeline`` options, you should use the address of the ``django`` service, http://localhost:8000.
Developing locally with HTTPS
-----------------------------

View File

@ -1,2 +1,2 @@
sphinx==5.3.0
sphinx-rtd-theme==1.1.1
sphinx==6.1.3
sphinx-rtd-theme==1.2.0

View File

@ -1,18 +1,18 @@
cookiecutter==2.1.1
sh==1.14.3; sys_platform != "win32"
sh==2.0.2; sys_platform != "win32"
binaryornot==0.4.4
# Code quality
# ------------------------------------------------------------------------------
black==22.12.0
black==23.1.0
isort==5.12.0
flake8==6.0.0
flake8-isort==6.0.0
pre-commit==3.0.1
pre-commit==3.1.0
# Testing
# ------------------------------------------------------------------------------
tox==4.4.2
tox==4.4.6
pytest==7.2.1
pytest-cookies==0.6.1
pytest-instafail==0.4.2
@ -20,7 +20,7 @@ pyyaml==6.0
# Scripting
# ------------------------------------------------------------------------------
PyGithub==1.57
gitpython==3.1.30
PyGithub==1.58.0
gitpython==3.1.31
jinja2==3.1.2
requests==2.28.2

View File

@ -82,14 +82,20 @@ def group_pulls_by_change_type(
grouped_pulls = {
"Changed": [],
"Fixed": [],
"Documentation": [],
"Updated": [],
}
for pull in pull_requests_list:
label_names = {label.name for label in pull.labels}
if "project infrastructure" in label_names:
# Don't mention it in the changelog
continue
if "update" in label_names:
group_name = "Updated"
elif "bug" in label_names:
group_name = "Fixed"
elif "docs" in label_names:
group_name = "Documentation"
else:
group_name = "Changed"
grouped_pulls[group_name].append(pull)

View File

@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup
# We use calendar versioning
version = "2023.01.28"
version = "2023.02.17"
with open("README.rst") as readme_file:
long_description = readme_file.read()

View File

@ -27,16 +27,15 @@ jobs:
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: |
requirements/base.txt
requirements/local.txt
{%- if cookiecutter.open_source_license != 'Not open source' %}
# Consider using pre-commit.ci for open source project
{%- endif %}
- name: Run pre-commit
uses: pre-commit/action@v2.0.3
uses: pre-commit/action@v3.0.0
# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
@ -85,7 +84,7 @@ jobs:
{%- else %}
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip

View File

@ -16,7 +16,7 @@ repos:
args: [--py310-plus]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

View File

@ -63,6 +63,20 @@ celery -A config.celery_app worker -l info
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
To run [periodic tasks](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html), you'll need to start the celery beat scheduler service. You can start it as a standalone process:
``` bash
cd {{cookiecutter.project_slug}}
celery -A config.celery_app beat
```
or you can embed the beat service inside a worker with the `-B` option (not recommended for production use):
``` bash
cd {{cookiecutter.project_slug}}
celery -A config.celery_app worker -B -l info
```
{%- endif %}
{%- if cookiecutter.use_mailhog == "y" %}

View File

@ -29,5 +29,13 @@ EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
# ------------------------------------------------------------------------------
TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
# django-webpack-loader
# ------------------------------------------------------------------------------
WEBPACK_LOADER["DEFAULT"][ # noqa F405
"LOADER_CLASS"
] = "webpack_loader.loader.FakeWebpackLoader"
{%- endif %}
# Your stuff...
# ------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
"@babel/preset-env": "^7.16.5",
"@popperjs/core": "^2.10.2",
"autoprefixer": "^10.4.0",
"babel-loader": "^8.2.3",
"babel-loader": "^9.1.2",
"bootstrap": "^5.1.3",
"browser-sync": "^2.27.7",
"css-loader": "^6.5.1",
@ -24,13 +24,13 @@
"node-sass-tilde-importer": "^1.0.2",
"pixrem": "^5.0.0",
"postcss": "^8.3.11",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.0.2",
"postcss-loader": "^7.0.2",
"postcss-preset-env": "^8.0.1",
"sass": "^1.43.4",
"sass-loader": "^12.4.0",
"sass-loader": "^13.2.0",
"webpack": "^5.65.0",
"webpack-bundle-tracker": "^1.4.0",
"webpack-cli": "^4.9.1",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.6.0",
"webpack-merge": "^5.8.0"
},

View File

@ -1,5 +1,5 @@
pytz==2022.7.1 # https://github.com/stub42/pytz
python-slugify==7.0.0 # https://github.com/un33k/python-slugify
python-slugify==8.0.1 # https://github.com/un33k/python-slugify
Pillow==9.4.0 # https://github.com/python-pillow/Pillow
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
{%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %}
@ -10,11 +10,11 @@ rcssmin==1.1.1 # https://github.com/ndparker/rcssmin
{%- endif %}
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
whitenoise==6.4.0 # https://github.com/evansd/whitenoise
{%- endif %}
redis==4.4.2 # https://github.com/redis/redis-py
redis==4.5.1 # 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
hiredis==2.2.2 # https://github.com/redis/hiredis-py
{%- endif %}
{%- if cookiecutter.use_celery == "y" %}
celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery
@ -29,11 +29,11 @@ uvicorn[standard]==0.20.0 # https://github.com/encode/uvicorn
# Django
# ------------------------------------------------------------------------------
django==4.0.8 # pyup: < 4.1 # https://www.djangoproject.com/
django==4.0.10 # pyup: < 4.1 # https://www.djangoproject.com/
django-environ==0.9.0 # https://github.com/joke2k/django-environ
django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils
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
django-crispy-forms==2.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.1 # https://github.com/django-compressor/django-compressor
@ -42,10 +42,10 @@ django-redis==5.2.0 # https://github.com/jazzband/django-redis
{%- if cookiecutter.use_drf == 'y' %}
# Django REST Framework
djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework
django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers
django-cors-headers==3.14.0 # https://github.com/adamchainz/django-cors-headers
# DRF-spectacular for api documentation
drf-spectacular==0.25.1 # https://github.com/tfranzel/drf-spectacular
{%- endif %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
django-webpack-loader==1.8.0 # https://github.com/django-webpack/django-webpack-loader
django-webpack-loader==1.8.1 # https://github.com/django-webpack/django-webpack-loader
{%- endif %}

View File

@ -1,6 +1,6 @@
-r base.txt
Werkzeug[watchdog]==2.2.2 # https://github.com/pallets/werkzeug
Werkzeug[watchdog]==2.2.3 # https://github.com/pallets/werkzeug
ipdb==0.13.11 # https://github.com/gotcha/ipdb
{%- if cookiecutter.use_docker == 'y' %}
psycopg2==2.9.5 # https://github.com/psycopg/psycopg2
@ -13,30 +13,30 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles
# Testing
# ------------------------------------------------------------------------------
mypy==0.982 # https://github.com/python/mypy
django-stubs==1.14.0 # https://github.com/typeddjango/django-stubs
mypy==1.0.1 # https://github.com/python/mypy
django-stubs==1.15.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" %}
djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs
djangorestframework-stubs==1.9.1 # https://github.com/typeddjango/djangorestframework-stubs
{%- endif %}
# Documentation
# ------------------------------------------------------------------------------
sphinx==5.3.0 # https://github.com/sphinx-doc/sphinx
sphinx==6.1.3 # https://github.com/sphinx-doc/sphinx
sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild
# Code quality
# ------------------------------------------------------------------------------
flake8==6.0.0 # https://github.com/PyCQA/flake8
flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort
coverage==7.1.0 # https://github.com/nedbat/coveragepy
black==22.12.0 # https://github.com/psf/black
coverage==7.2.0 # https://github.com/nedbat/coveragepy
black==23.1.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==3.0.1 # https://github.com/pre-commit/pre-commit
pre-commit==3.1.0 # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------

View File

@ -8,10 +8,10 @@ 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.14.0 # https://github.com/getsentry/sentry-python
sentry-sdk==1.15.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
hiredis==2.2.2 # https://github.com/redis/hiredis-py
{%- endif %}
# Django

View File

@ -10,7 +10,6 @@ User = get_user_model()
@admin.register(User)
class UserAdmin(auth_admin.UserAdmin):
form = UserAdminChangeForm
add_form = UserAdminCreationForm
fieldsets = (

View File

@ -7,7 +7,6 @@ from factory.django import DjangoModelFactory
class UserFactory(DjangoModelFactory):
username = Faker("user_name")
email = Faker("email")
name = Faker("name")

View File

@ -1,27 +1,32 @@
from django.test import RequestFactory
import pytest
from rest_framework.test import APIRequestFactory
from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet
from {{ cookiecutter.project_slug }}.users.models import User
class TestUserViewSet:
def test_get_queryset(self, user: User, rf: RequestFactory):
@pytest.fixture
def api_rf(self) -> APIRequestFactory:
return APIRequestFactory()
def test_get_queryset(self, user: User, api_rf: APIRequestFactory):
view = UserViewSet()
request = rf.get("/fake-url/")
request = api_rf.get("/fake-url/")
request.user = user
view.request = request
assert user in view.get_queryset()
def test_me(self, user: User, rf: RequestFactory):
def test_me(self, user: User, api_rf: APIRequestFactory):
view = UserViewSet()
request = rf.get("/fake-url/")
request = api_rf.get("/fake-url/")
request.user = user
view.request = request
response = view.me(request)
response = view.me(request) # type: ignore
assert response.data == {
"username": user.username,

View File

@ -9,7 +9,6 @@ User = get_user_model()
class UserDetailView(LoginRequiredMixin, DetailView):
model = User
slug_field = "username"
slug_url_kwarg = "username"
@ -19,7 +18,6 @@ user_detail_view = UserDetailView.as_view()
class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
model = User
fields = ["name"]
success_message = _("Information successfully updated")
@ -38,7 +36,6 @@ user_update_view = UserUpdateView.as_view()
class UserRedirectView(LoginRequiredMixin, RedirectView):
permanent = False
def get_redirect_url(self):