mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-09-20 19:02:37 +03:00
Uograde CC 240812
This commit is contained in:
commit
6c1eb5972d
10
.github/contributors.json
vendored
10
.github/contributors.json
vendored
|
@ -1603,5 +1603,15 @@
|
|||
"name": "Ali Shamakhi",
|
||||
"github_login": "ali-shamakhi",
|
||||
"twitter_username": ""
|
||||
},
|
||||
{
|
||||
"name": "Filipe Nascimento",
|
||||
"github_login": "FilipeNas",
|
||||
"twitter_username": ""
|
||||
},
|
||||
{
|
||||
"name": "Kevin Mills",
|
||||
"github_login": "millsks",
|
||||
"twitter_username": ""
|
||||
}
|
||||
]
|
||||
|
|
|
@ -26,14 +26,14 @@ repos:
|
|||
args: ["--tab-width", "2"]
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.16.0
|
||||
rev: v3.17.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py312-plus]
|
||||
exclude: hooks/
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.4.2
|
||||
rev: 24.8.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
|
@ -43,7 +43,7 @@ repos:
|
|||
- id: isort
|
||||
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 7.1.0
|
||||
rev: 7.1.1
|
||||
hooks:
|
||||
- id: flake8
|
||||
|
||||
|
|
154
CHANGELOG.md
154
CHANGELOG.md
|
@ -3,6 +3,160 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
|
|||
|
||||
<!-- GENERATOR_PLACEHOLDER -->
|
||||
|
||||
## 2024.08.09
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update Ruff pre-commit hook to v0.5.7 ([#5293](https://github.com/cookiecutter/cookiecutter-django/pull/5293))
|
||||
|
||||
## 2024.08.08
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update ruff to 0.5.7 ([#5291](https://github.com/cookiecutter/cookiecutter-django/pull/5291))
|
||||
|
||||
- Bump python from 3.12.4 to 3.12.5 in docs Docker image ([#5287](https://github.com/cookiecutter/cookiecutter-django/pull/5287))
|
||||
|
||||
- Bump python from 3.12.4 to 3.12.5 in local Docker image ([#5289](https://github.com/cookiecutter/cookiecutter-django/pull/5289))
|
||||
|
||||
- Bump python from 3.12.4 to 3.12.5 in production Docker image ([#5290](https://github.com/cookiecutter/cookiecutter-django/pull/5290))
|
||||
|
||||
## 2024.08.07
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update tox to 4.17.1 ([#5285](https://github.com/cookiecutter/cookiecutter-django/pull/5285))
|
||||
|
||||
- Update django-anymail to 11.1 ([#5286](https://github.com/cookiecutter/cookiecutter-django/pull/5286))
|
||||
|
||||
## 2024.08.06
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update django to 5.0.8 ([#5281](https://github.com/cookiecutter/cookiecutter-django/pull/5281))
|
||||
|
||||
## 2024.08.05
|
||||
|
||||
|
||||
### Documentation
|
||||
|
||||
- Simplify documentation for https in local development ([#5252](https://github.com/cookiecutter/cookiecutter-django/pull/5252))
|
||||
|
||||
- Add Medium story in the Articles section ([#5275](https://github.com/cookiecutter/cookiecutter-django/pull/5275))
|
||||
|
||||
### Updated
|
||||
|
||||
- Update coverage to 7.6.1 ([#5276](https://github.com/cookiecutter/cookiecutter-django/pull/5276))
|
||||
|
||||
- Auto-update pre-commit hooks ([#5277](https://github.com/cookiecutter/cookiecutter-django/pull/5277))
|
||||
|
||||
## 2024.08.04
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update uvicorn to 0.30.5 ([#5272](https://github.com/cookiecutter/cookiecutter-django/pull/5272))
|
||||
|
||||
- Update ruff to 0.5.6 ([#5273](https://github.com/cookiecutter/cookiecutter-django/pull/5273))
|
||||
|
||||
- Auto-update pre-commit hooks ([#5274](https://github.com/cookiecutter/cookiecutter-django/pull/5274))
|
||||
|
||||
## 2024.07.31
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update uvicorn to 0.30.4 ([#5271](https://github.com/cookiecutter/cookiecutter-django/pull/5271))
|
||||
|
||||
- Update mypy to 1.11.1 ([#5270](https://github.com/cookiecutter/cookiecutter-django/pull/5270))
|
||||
|
||||
- Update pre-commit to 3.8.0 ([#5257](https://github.com/cookiecutter/cookiecutter-django/pull/5257))
|
||||
|
||||
- Update pyupgrade pre-commit hook to v3.17.0 ([#5258](https://github.com/cookiecutter/cookiecutter-django/pull/5258))
|
||||
|
||||
- Update redis to 5.0.8 ([#5265](https://github.com/cookiecutter/cookiecutter-django/pull/5265))
|
||||
|
||||
- Update django-stubs to 5.0.4 ([#5256](https://github.com/cookiecutter/cookiecutter-django/pull/5256))
|
||||
|
||||
- Update mypy to 1.11.0 ([#5231](https://github.com/cookiecutter/cookiecutter-django/pull/5231))
|
||||
|
||||
- Update django-allauth to 64.0.0 ([#5269](https://github.com/cookiecutter/cookiecutter-django/pull/5269))
|
||||
|
||||
- Update sentry-sdk to 2.12.0 ([#5268](https://github.com/cookiecutter/cookiecutter-django/pull/5268))
|
||||
|
||||
## 2024.07.26
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update ruff to 0.5.5 ([#5250](https://github.com/cookiecutter/cookiecutter-django/pull/5250))
|
||||
|
||||
## 2024.07.25
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade to Django 5.0 ([#5199](https://github.com/cookiecutter/cookiecutter-django/pull/5199))
|
||||
|
||||
### Updated
|
||||
|
||||
- Update pytest to 8.3.2 ([#5249](https://github.com/cookiecutter/cookiecutter-django/pull/5249))
|
||||
|
||||
- Update sentry-sdk to 2.11.0 ([#5247](https://github.com/cookiecutter/cookiecutter-django/pull/5247))
|
||||
|
||||
## 2024.07.24
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
- fix non existent of two scoops of django image ([#5248](https://github.com/cookiecutter/cookiecutter-django/pull/5248))
|
||||
|
||||
## 2024.07.23
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
- Ensure that awscli service has a CMD to fix #5241 ([#5245](https://github.com/cookiecutter/cookiecutter-django/pull/5245))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Downgrade watchfiles ([#5243](https://github.com/cookiecutter/cookiecutter-django/pull/5243))
|
||||
|
||||
## 2024.07.22
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update django-compressor to 4.5.1 ([#5240](https://github.com/cookiecutter/cookiecutter-django/pull/5240))
|
||||
|
||||
## 2024.07.21
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update ruff to 0.5.4 ([#5237](https://github.com/cookiecutter/cookiecutter-django/pull/5237))
|
||||
|
||||
- Update pytest to 8.3.1 ([#5236](https://github.com/cookiecutter/cookiecutter-django/pull/5236))
|
||||
|
||||
- Update sphinx to 7.4.7 ([#5235](https://github.com/cookiecutter/cookiecutter-django/pull/5235))
|
||||
|
||||
## 2024.07.20
|
||||
|
||||
|
||||
### Updated
|
||||
|
||||
- Update hiredis to 3.0.0 ([#5228](https://github.com/cookiecutter/cookiecutter-django/pull/5228))
|
||||
|
||||
- Update uvicorn to 0.30.3 ([#5234](https://github.com/cookiecutter/cookiecutter-django/pull/5234))
|
||||
|
||||
- Update django-crispy-forms to 2.3 ([#5229](https://github.com/cookiecutter/cookiecutter-django/pull/5229))
|
||||
|
||||
- Auto-update pre-commit hooks ([#5232](https://github.com/cookiecutter/cookiecutter-django/pull/5232))
|
||||
|
||||
## 2024.07.19
|
||||
|
||||
|
||||
|
|
|
@ -852,6 +852,13 @@ Listed in alphabetical order.
|
|||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Filipe Nascimento</td>
|
||||
<td>
|
||||
<a href="https://github.com/FilipeNas">FilipeNas</a>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Florian Idelberger</td>
|
||||
<td>
|
||||
|
@ -1286,6 +1293,13 @@ Listed in alphabetical order.
|
|||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Kevin Mills</td>
|
||||
<td>
|
||||
<a href="https://github.com/millsks">millsks</a>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Kevin Ndung'u</td>
|
||||
<td>
|
||||
|
|
|
@ -19,7 +19,7 @@ production-ready Django projects quickly.
|
|||
|
||||
## Features
|
||||
|
||||
- For Django 4.2
|
||||
- For Django 5.0
|
||||
- Works with Python 3.12
|
||||
- Renders Django projects with 100% starting test coverage
|
||||
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
|
||||
|
@ -67,7 +67,7 @@ Projects that provide financial support to the maintainers:
|
|||
|
||||
### Two Scoops of Django
|
||||
|
||||
[](https://www.feldroy.com/two-scoops-press#two-scoops-of-django)
|
||||
[](https://www.feldroy.com/two-scoops-press#two-scoops-of-django)
|
||||
|
||||
Two Scoops of Django 3.x is the best ice cream-themed Django reference in the universe!
|
||||
|
||||
|
@ -240,6 +240,7 @@ experience better.
|
|||
|
||||
## Articles
|
||||
|
||||
- [Why cookiecutter-django is Essential for Your Next Django Project](https://medium.com/@millsks/why-cookiecutter-django-is-essential-for-your-next-django-project-7d3c00cdce51) - Aug. 4, 2024
|
||||
- [How to Make Your Own Django Cookiecutter Template!](https://medium.com/@FatemeFouladkar/how-to-make-your-own-django-cookiecutter-template-a753d4cbb8c2) - Aug. 10, 2023
|
||||
- [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
|
||||
|
|
|
@ -43,7 +43,6 @@ Before doing any git commit, `pre-commit`_ should be installed globally on your
|
|||
|
||||
Failing to do so will result with a bunch of CI and Linter errors that can be avoided with pre-commit.
|
||||
|
||||
|
||||
Run the Stack
|
||||
-------------
|
||||
|
||||
|
@ -91,7 +90,6 @@ Also, please note that the ``docker exec`` does not work for running management
|
|||
|
||||
When ``DEBUG`` is set to ``True``, the host is validated against ``['localhost', '127.0.0.1', '[::1]']``. This is adequate when running a ``virtualenv``. For Docker, in the ``config.settings.local``, add your host development server IP to ``INTERNAL_IPS`` or ``ALLOWED_HOSTS`` if the variable exists.
|
||||
|
||||
|
||||
.. _envs:
|
||||
|
||||
Configuring the Environment
|
||||
|
@ -117,8 +115,8 @@ The most important thing for us here now is ``env_file`` section enlisting ``./.
|
|||
|
||||
.envs
|
||||
├── .local
|
||||
│ ├── .django
|
||||
│ └── .postgres
|
||||
│ ├── .django
|
||||
│ └── .postgres
|
||||
└── .production
|
||||
├── .django
|
||||
└── .postgres
|
||||
|
@ -195,7 +193,6 @@ The ``container_name`` from the yml file can be used to check on containers with
|
|||
$ docker logs <project_slug>_local_celeryworker
|
||||
$ docker top <project_slug>_local_celeryworker
|
||||
|
||||
|
||||
Notice that the ``container_name`` is generated dynamically using your project slug as a prefix
|
||||
|
||||
Mailpit
|
||||
|
@ -245,118 +242,64 @@ The stack comes with a dedicated node service to build the static assets, watch
|
|||
.. _Sass: https://sass-lang.com/
|
||||
.. _live reloading: https://browsersync.io
|
||||
|
||||
Developing locally with HTTPS
|
||||
-----------------------------
|
||||
(Optionally) Developing locally with HTTPS
|
||||
------------------------------------------
|
||||
|
||||
Increasingly it is becoming necessary to develop software in a secure environment in order that there are very few changes when deploying to production. Recently Facebook changed their policies for apps/sites that use Facebook login which requires the use of an HTTPS URL for the OAuth redirect URL. So if you want to use the ``users`` application with a OAuth provider such as Facebook, securing your communication to the local development environment will be necessary.
|
||||
|
||||
In order to create a secure environment, we need to have a trusted SSL certificate installed in our Docker application.
|
||||
|
||||
#. **Let's Encrypt**
|
||||
|
||||
The official line from Let’s Encrypt is:
|
||||
|
||||
[For local development section] ... The best option: Generate your own certificate, either self-signed or signed by a local root, and trust it in your operating system’s trust store. Then use that certificate in your local web server. See below for details.
|
||||
|
||||
See `letsencrypt.org - certificates-for-localhost`_
|
||||
|
||||
.. _`letsencrypt.org - certificates-for-localhost`: https://letsencrypt.org/docs/certificates-for-localhost/
|
||||
|
||||
#. **mkcert: Valid Https Certificates For Localhost**
|
||||
|
||||
`mkcert`_ is a simple by design tool that hides all the arcane knowledge required to generate valid TLS certificates. It works for any hostname or IP, including localhost. It supports macOS, Linux, and Windows, and Firefox, Chrome and Java. It even works on mobile devices with a couple manual steps.
|
||||
|
||||
See https://blog.filippo.io/mkcert-valid-https-certificates-for-localhost/
|
||||
|
||||
.. _`mkcert`: https://github.com/FiloSottile/mkcert/blob/master/README.md#supported-root-stores
|
||||
|
||||
After installing a trusted TLS certificate, configure your docker installation. We are going to configure an ``nginx`` reverse-proxy server. This makes sure that it does not interfere with our ``traefik`` configuration that is reserved for production environments.
|
||||
|
||||
These are the places that you should configure to secure your local environment.
|
||||
|
||||
certs
|
||||
Nginx
|
||||
~~~~~
|
||||
|
||||
Take the certificates that you generated and place them in a folder called ``certs`` in the project's root folder. Assuming that you registered your local hostname as ``my-dev-env.local``, the certificates you will put in the folder should have the names ``my-dev-env.local.crt`` and ``my-dev-env.local.key``.
|
||||
If you want to add some sort of social authentication with a OAuth provider such as Facebook, securing your communication to the local development environment will be necessary. These providers usually require that you use an HTTPS URL for the OAuth redirect URL for the Facebook login to work appropriately.
|
||||
|
||||
docker-compose.local.yml
|
||||
~~~~~~~~~
|
||||
Here is a link to an article on `how to add HTTPS using Nginx`_ to your local docker installation. This also includes how to serve files from the ``media`` location, in the event that you are want to serve user-uploaded content.
|
||||
|
||||
#. Add the ``nginx-proxy`` service. ::
|
||||
.. _`how to add HTTPS using Nginx`: https://afroshok.com/cookiecutter-https
|
||||
|
||||
...
|
||||
Webpack
|
||||
~~~~~~~
|
||||
|
||||
nginx-proxy:
|
||||
image: jwilder/nginx-proxy:alpine
|
||||
container_name: nginx-proxy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- ./certs:/etc/nginx/certs
|
||||
restart: always
|
||||
depends_on:
|
||||
- django
|
||||
If you are using Webpack, first install ``mkcert``_. It is a simple by design tool that hides all the arcane knowledge required to generate valid TLS certificates. It works for any hostname or IP, including localhost. It supports macOS, Linux, and Windows, and Firefox, Chrome and Java. It even works on mobile devices with a couple manual steps. See https://blog.filippo.io/mkcert-valid-https-certificates-for-localhost/
|
||||
|
||||
...
|
||||
.. _`mkcert`: https://github.com/FiloSottile/mkcert/blob/master/README.md#supported-root-stores
|
||||
|
||||
#. Link the ``nginx-proxy`` to ``django`` through environment variables.
|
||||
These are the places that you should configure to secure your local environment. Take the certificates that you generated and place them in a folder called ``certs`` in the project's root folder. Configure an ``nginx`` reverse-proxy server as a ``service`` in the ``docker-compose.local.yml``. This makes sure that it does not interfere with our ``traefik`` configuration that is reserved for production environments.
|
||||
|
||||
``django`` already has an ``.env`` file connected to it. Add the following variables. You should do this especially if you are working with a team and you want to keep your local environment details to yourself.
|
||||
Assuming that you registered your local hostname as ``my-dev-env.local``, the certificates you will put in the folder should have the names ``my-dev-env.local.crt`` and ``my-dev-env.local.key``.
|
||||
|
||||
::
|
||||
1. Add the ``nginx-proxy`` service to the ``docker-compose.local.yml``. ::
|
||||
|
||||
# HTTPS
|
||||
# ------------------------------------------------------------------------------
|
||||
VIRTUAL_HOST=my-dev-env.local
|
||||
VIRTUAL_PORT=8000
|
||||
nginx-proxy:
|
||||
image: jwilder/nginx-proxy:alpine
|
||||
container_name: nginx-proxy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- ./certs:/etc/nginx/certs
|
||||
restart: always
|
||||
depends_on:
|
||||
- node
|
||||
environment:
|
||||
- VIRTUAL_HOST=my-dev-env.local
|
||||
- VIRTUAL_PORT=3000
|
||||
|
||||
The services run behind the reverse proxy.
|
||||
|
||||
config/settings/local.py
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You should allow the new hostname. ::
|
||||
2. Add the local secure domain to the ``config/settings/local.py``. You should allow the new hostname ::
|
||||
|
||||
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "my-dev-env.local"]
|
||||
|
||||
3. Add the following configuration to the ``devServer`` section of ``webpack/dev.config.js`` ::
|
||||
|
||||
client: {
|
||||
webSocketURL: 'auto://0.0.0.0:0/ws', // note the `:0` after `0.0.0.0`
|
||||
},
|
||||
|
||||
|
||||
Rebuild your ``docker`` application. ::
|
||||
|
||||
$ docker compose -f docker-compose.local.yml up -d --build
|
||||
|
||||
Go to your browser and type in your URL bar ``https://my-dev-env.local``
|
||||
Go to your browser and type in your URL bar ``https://my-dev-env.local``.
|
||||
|
||||
See `https with nginx`_ for more information on this configuration.
|
||||
For more on this configuration, see `https with nginx`_.
|
||||
|
||||
.. _`https with nginx`: https://codewithhugo.com/docker-compose-local-https/
|
||||
|
||||
.gitignore
|
||||
~~~~~~~~~~
|
||||
|
||||
Add ``certs/*`` to the ``.gitignore`` file. This allows the folder to be included in the repo but its contents to be ignored.
|
||||
|
||||
*This configuration is for local development environments only. Do not use this for production since you might expose your local* ``rootCA-key.pem``.
|
||||
|
||||
Webpack
|
||||
~~~~~~~
|
||||
|
||||
If you are using Webpack:
|
||||
|
||||
1. On the ``nginx-proxy`` service in ``docker-compose.local.yml``, change ``depends_on`` to ``node`` instead of ``django``.
|
||||
|
||||
2. On the ``node`` service in ``docker-compose.local.yml``, add the following environment configuration:
|
||||
|
||||
::
|
||||
|
||||
environment:
|
||||
- VIRTUAL_HOST=my-dev-env.local
|
||||
- VIRTUAL_PORT=3000
|
||||
|
||||
3. Add the following configuration to the ``devServer`` section of ``webpack/dev.config.js``:
|
||||
|
||||
::
|
||||
|
||||
client: {
|
||||
webSocketURL: 'auto://0.0.0.0:0/ws', // note the `:0` after `0.0.0.0`
|
||||
},
|
||||
.. _`https with nginx`: https://codewithhugo.com/docker-compose-local-https/
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
sphinx==7.4.6
|
||||
sphinx==7.4.7
|
||||
sphinx-rtd-theme==2.0.0
|
||||
myst-parser==3.0.1
|
||||
myst-parser==4.0.0
|
||||
|
|
|
@ -4,19 +4,19 @@ binaryornot==0.4.4
|
|||
|
||||
# Code quality
|
||||
# ------------------------------------------------------------------------------
|
||||
ruff==0.5.3
|
||||
ruff==0.5.7
|
||||
django-upgrade==1.20.0
|
||||
djlint==1.34.1
|
||||
pre-commit==3.7.1
|
||||
pre-commit==3.8.0
|
||||
|
||||
# Testing
|
||||
# ------------------------------------------------------------------------------
|
||||
tox==4.16.0
|
||||
pytest==8.2.2
|
||||
tox==4.17.1
|
||||
pytest==8.3.2
|
||||
pytest-xdist==3.6.1
|
||||
pytest-cookies==0.7.0
|
||||
pytest-instafail==0.5.0
|
||||
pyyaml==6.0.1
|
||||
pyyaml==6.0.2
|
||||
|
||||
# Scripting
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
4
setup.py
4
setup.py
|
@ -5,7 +5,7 @@ except ImportError:
|
|||
from distutils.core import setup
|
||||
|
||||
# We use calendar versioning
|
||||
version = "2024.07.19"
|
||||
version = "2024.08.09"
|
||||
|
||||
with open("README.md") as readme_file:
|
||||
long_description = readme_file.read()
|
||||
|
@ -24,7 +24,7 @@ setup(
|
|||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Console",
|
||||
"Framework :: Django :: 4.2",
|
||||
"Framework :: Django :: 5.0",
|
||||
"Intended Audience :: Developers",
|
||||
"Natural Language :: English",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
|
|
|
@ -229,7 +229,7 @@ def test_django_upgrade_passes(cookies, context_override):
|
|||
try:
|
||||
sh.django_upgrade(
|
||||
"--target-version",
|
||||
"4.2",
|
||||
"5.0",
|
||||
*python_files,
|
||||
_cwd=str(result.project_path),
|
||||
)
|
||||
|
|
|
@ -35,11 +35,11 @@ repos:
|
|||
rev: '1.20.0'
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: ['--target-version', '4.2']
|
||||
args: ['--target-version', '5.0']
|
||||
|
||||
# Run the Ruff linter.
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.5.3
|
||||
rev: v0.5.7
|
||||
hooks:
|
||||
# Linter
|
||||
- id: ruff
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# define an alias for the specific python version used in this file.
|
||||
FROM docker.io/python:3.12.4-slim-bookworm AS python
|
||||
FROM docker.io/python:3.12.5-slim-bookworm AS python
|
||||
|
||||
# Python build stage
|
||||
FROM python AS python-build-stage
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# define an alias for the specific python version used in this file.
|
||||
FROM docker.io/python:3.12.4-slim-bookworm AS python
|
||||
FROM docker.io/python:3.12.5-slim-bookworm AS python
|
||||
|
||||
|
||||
# Python build stage
|
||||
|
|
|
@ -2,6 +2,7 @@ FROM docker.io/amazon/aws-cli:2.17.0
|
|||
|
||||
# Clear entrypoint from the base image, otherwise it's always calling the aws CLI
|
||||
ENTRYPOINT []
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance
|
||||
COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced
|
||||
|
|
|
@ -25,7 +25,7 @@ RUN npm run build
|
|||
|
||||
{%- endif %}
|
||||
# define an alias for the specific python version used in this file.
|
||||
FROM docker.io/python:3.12.4-slim-bookworm AS python
|
||||
FROM docker.io/python:3.12.5-slim-bookworm AS python
|
||||
|
||||
# Python build stage
|
||||
FROM python AS python-build-stage
|
||||
|
|
|
@ -11,7 +11,7 @@ argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi
|
|||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||
whitenoise==6.7.0 # https://github.com/evansd/whitenoise
|
||||
{%- endif %}
|
||||
redis==5.0.7 # https://github.com/redis/redis-py
|
||||
redis==5.0.8 # https://github.com/redis/redis-py
|
||||
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
|
||||
hiredis==3.0.0 # https://github.com/redis/hiredis-py
|
||||
{%- endif %}
|
||||
|
@ -23,20 +23,20 @@ flower==2.0.1 # https://github.com/mher/flower
|
|||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_async == 'y' %}
|
||||
uvicorn[standard]==0.30.3 # https://github.com/encode/uvicorn
|
||||
uvicorn[standard]==0.30.5 # https://github.com/encode/uvicorn
|
||||
uvicorn-worker==0.2.0 # https://github.com/Kludex/uvicorn-worker
|
||||
{%- endif %}
|
||||
|
||||
# Django
|
||||
# ------------------------------------------------------------------------------
|
||||
django==4.2.14 # pyup: < 5.0 # https://www.djangoproject.com/
|
||||
django==5.0.8 # pyup: < 5.1 # https://www.djangoproject.com/
|
||||
django-environ==0.11.2 # https://github.com/joke2k/django-environ
|
||||
django-model-utils==4.5.1 # https://github.com/jazzband/django-model-utils
|
||||
django-allauth[mfa]==0.63.6 # https://github.com/pennersr/django-allauth
|
||||
django-allauth[mfa]==64.0.0 # https://github.com/pennersr/django-allauth
|
||||
django-crispy-forms==2.3 # https://github.com/django-crispy-forms/django-crispy-forms
|
||||
crispy-bootstrap5==2024.2 # https://github.com/django-crispy-forms/crispy-bootstrap5
|
||||
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
|
||||
django-compressor==4.5 # https://github.com/django-compressor/django-compressor
|
||||
django-compressor==4.5.1 # https://github.com/django-compressor/django-compressor
|
||||
{%- endif %}
|
||||
django-redis==5.4.0 # https://github.com/jazzband/django-redis
|
||||
{%- if cookiecutter.use_drf == 'y' %}
|
||||
|
|
|
@ -8,31 +8,31 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg
|
|||
psycopg[binary]==3.2.1 # https://github.com/psycopg/psycopg
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}
|
||||
watchfiles==0.22.0 # https://github.com/samuelcolvin/watchfiles
|
||||
watchfiles==0.21.0 # https://github.com/samuelcolvin/watchfiles
|
||||
{%- endif %}
|
||||
|
||||
# Testing
|
||||
# ------------------------------------------------------------------------------
|
||||
mypy==1.10.0 # https://github.com/python/mypy
|
||||
django-stubs[compatible-mypy]==5.0.2 # https://github.com/typeddjango/django-stubs
|
||||
pytest==8.2.2 # https://github.com/pytest-dev/pytest
|
||||
mypy==1.11.1 # https://github.com/python/mypy
|
||||
django-stubs[compatible-mypy]==5.0.4 # https://github.com/typeddjango/django-stubs
|
||||
pytest==8.3.2 # https://github.com/pytest-dev/pytest
|
||||
pytest-sugar==1.0.0 # https://github.com/Frozenball/pytest-sugar
|
||||
{%- if cookiecutter.use_drf == "y" %}
|
||||
djangorestframework-stubs[compatible-mypy]==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs
|
||||
djangorestframework-stubs==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs
|
||||
{%- endif %}
|
||||
|
||||
# Documentation
|
||||
# ------------------------------------------------------------------------------
|
||||
sphinx==7.4.6 # https://github.com/sphinx-doc/sphinx
|
||||
sphinx==7.4.7 # https://github.com/sphinx-doc/sphinx
|
||||
sphinx-autobuild==2024.4.16 # https://github.com/GaretJax/sphinx-autobuild
|
||||
sphinx-rtd-theme==2.0.0 # https://pypi.org/project/sphinx-rtd-theme/
|
||||
|
||||
# Code quality
|
||||
# ------------------------------------------------------------------------------
|
||||
ruff==0.5.3 # https://github.com/astral-sh/ruff
|
||||
coverage==7.6.0 # https://github.com/nedbat/coveragepy
|
||||
ruff==0.5.7 # https://github.com/astral-sh/ruff
|
||||
coverage==7.6.1 # https://github.com/nedbat/coveragepy
|
||||
djlint==1.34.1 # https://github.com/Riverside-Healthcare/djLint
|
||||
pre-commit==3.7.1 # https://github.com/pre-commit/pre-commit
|
||||
pre-commit==3.8.0 # https://github.com/pre-commit/pre-commit
|
||||
|
||||
# Django
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -8,7 +8,7 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg
|
|||
Collectfasta==3.2.0 # https://github.com/jasongi/collectfasta
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_sentry == "y" %}
|
||||
sentry-sdk==2.10.0 # https://github.com/getsentry/sentry-python
|
||||
sentry-sdk==2.12.0 # https://github.com/getsentry/sentry-python
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
|
||||
hiredis==3.0.0 # https://github.com/redis/hiredis-py
|
||||
|
@ -24,21 +24,21 @@ django-storages[google]==1.14.4 # https://github.com/jschneier/django-storages
|
|||
django-storages[azure]==1.14.4 # https://github.com/jschneier/django-storages
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.mail_service == 'Mailgun' %}
|
||||
django-anymail[mailgun]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[mailgun]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Amazon SES' %}
|
||||
django-anymail[amazon-ses]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[amazon-ses]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Mailjet' %}
|
||||
django-anymail[mailjet]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[mailjet]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Mandrill' %}
|
||||
django-anymail[mandrill]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[mandrill]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Postmark' %}
|
||||
django-anymail[postmark]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[postmark]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Sendgrid' %}
|
||||
django-anymail[sendgrid]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[sendgrid]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Brevo' %}
|
||||
django-anymail[brevo]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[brevo]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'SparkPost' %}
|
||||
django-anymail[sparkpost]==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail[sparkpost]==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- elif cookiecutter.mail_service == 'Other SMTP' %}
|
||||
django-anymail==11.0.1 # https://github.com/anymail/django-anymail
|
||||
django-anymail==11.1 # https://github.com/anymail/django-anymail
|
||||
{%- endif %}
|
||||
|
|
|
@ -1 +1 @@
|
|||
python-3.12.4
|
||||
python-3.12.5
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.db.models import QuerySet
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DetailView
|
||||
|
@ -23,12 +24,12 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
|
|||
fields = ["first_name", "last_name"]
|
||||
success_message = _("Information successfully updated")
|
||||
|
||||
def get_success_url(self):
|
||||
# for mypy to know that the user is authenticated
|
||||
assert self.request.user.is_authenticated
|
||||
def get_success_url(self) -> str:
|
||||
assert self.request.user.is_authenticated # type guard
|
||||
return self.request.user.get_absolute_url()
|
||||
|
||||
def get_object(self):
|
||||
def get_object(self, queryset: QuerySet | None=None) -> User:
|
||||
assert self.request.user.is_authenticated # type guard
|
||||
return self.request.user
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user