diff --git a/.flake8 b/.flake8
index 84b4b4411..3a87b269b 100644
--- a/.flake8
+++ b/.flake8
@@ -1,3 +1,4 @@
[flake8]
exclude = docs
max-line-length = 119
+extend-ignore = E203
diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md
index 0e5ec12c4..da0480f1e 100644
--- a/.github/ISSUE_TEMPLATE/bug.md
+++ b/.github/ISSUE_TEMPLATE/bug.md
@@ -42,7 +42,7 @@ labels: bug
- Python version, run `python3 -V`:
- Docker version (if using Docker), run `docker --version`:
- - docker-compose version (if using Docker), run `docker-compose --version`:
+ - docker compose version (if using Docker), run `docker compose --version`:
- ...
- Options selected and/or [replay file](https://cookiecutter.readthedocs.io/en/latest/advanced/replay.html):
diff --git a/.github/contributors.json b/.github/contributors.json
index 8a9a2d205..426689770 100644
--- a/.github/contributors.json
+++ b/.github/contributors.json
@@ -1418,5 +1418,45 @@
"name": "villancikos",
"github_login": "villancikos",
"twitter_username": ""
+ },
+ {
+ "name": "Imran Rahman",
+ "github_login": "infraredCoding",
+ "twitter_username": ""
+ },
+ {
+ "name": "hleroy",
+ "github_login": "hleroy",
+ "twitter_username": ""
+ },
+ {
+ "name": "Shayan Karimi",
+ "github_login": "shywn-mrk",
+ "twitter_username": "shywn_mrk"
+ },
+ {
+ "name": "Sadra Yahyapour",
+ "github_login": "lnxpy",
+ "twitter_username": "lnxpylnxpy"
+ },
+ {
+ "name": "Tharushan",
+ "github_login": "Tharushan",
+ "twitter_username": ""
+ },
+ {
+ "name": "Fateme Fouladkar",
+ "github_login": "FatemeFouladkar",
+ "twitter_username": ""
+ },
+ {
+ "name": "zhaoruibing",
+ "github_login": "zhaoruibing",
+ "twitter_username": ""
+ },
+ {
+ "name": "MinWoo Sung",
+ "github_login": "SungMinWoo",
+ "twitter_username": ""
}
]
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index dbda77b5e..3ff9f06aa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -75,7 +75,7 @@ jobs:
- name: Webpack
args: "frontend_pipeline=Webpack use_heroku=y"
- name: Email Username
- args: "username_type=email ci_tool=Github"
+ args: "username_type=email ci_tool=Github project_name='Something superduper long - the great amazing project' project_slug=my_awesome_project"
name: "Bare metal ${{ matrix.script.name }}"
runs-on: ubuntu-latest
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 26f80b163..87c796b0c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -17,13 +17,13 @@ repos:
- id: detect-private-key
- repo: https://github.com/pre-commit/mirrors-prettier
- rev: "v3.0.0"
+ rev: "v3.0.2"
hooks:
- id: prettier
args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade
- rev: v3.9.0
+ rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py311-plus]
@@ -40,7 +40,7 @@ repos:
- id: isort
- repo: https://github.com/PyCQA/flake8
- rev: 6.0.0
+ rev: 6.1.0
hooks:
- id: flake8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fb659aaa..8c5813122 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,170 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
+## 2023.08.19
+
+
+### Changed
+
+- Override `_after_postgeneration` to force save in `UserFactory` ([#4534](https://github.com/cookiecutter/cookiecutter-django/pull/4534))
+
+## 2023.08.17
+
+
+### Updated
+
+- Update argon2-cffi to 23.1.0 ([#4527](https://github.com/cookiecutter/cookiecutter-django/pull/4527))
+
+- Auto-update pre-commit hooks ([#4530](https://github.com/cookiecutter/cookiecutter-django/pull/4530))
+
+## 2023.08.16
+
+
+### Updated
+
+- Update django-upgrade to 1.14.1 ([#4528](https://github.com/cookiecutter/cookiecutter-django/pull/4528))
+
+## 2023.08.15
+
+
+### Updated
+
+- Update redis to 5.0.0 ([#4526](https://github.com/cookiecutter/cookiecutter-django/pull/4526))
+
+## 2023.08.14
+
+
+### Changed
+
+- Install Django and DRF stubs with `compatible-mypy` extra (as per offical recommendation) ([#4361](https://github.com/cookiecutter/cookiecutter-django/pull/4361))
+
+- Fix `overrideCommand` value in `devcontainer` so that the `django` container can run (#4517) ([#4517](https://github.com/cookiecutter/cookiecutter-django/pull/4517))
+
+### Fixed
+
+- Prevent error in data migration caused by long project name ([#4525](https://github.com/cookiecutter/cookiecutter-django/pull/4525))
+
+- Remove unused gulp-concat when Webpack is selected ([#4520](https://github.com/cookiecutter/cookiecutter-django/pull/4520))
+
+- Exclude env files from container image (add .envs/ to .dockerignore) ([#4476](https://github.com/cookiecutter/cookiecutter-django/pull/4476))
+
+### Updated
+
+- Update werkzeug to 2.3.7 ([#4521](https://github.com/cookiecutter/cookiecutter-django/pull/4521))
+
+- Update coverage to 7.3.0 ([#4516](https://github.com/cookiecutter/cookiecutter-django/pull/4516))
+
+- Update django-debug-toolbar to 4.2.0 ([#4511](https://github.com/cookiecutter/cookiecutter-django/pull/4511))
+
+- Update flower to 2.0.1 ([#4518](https://github.com/cookiecutter/cookiecutter-django/pull/4518))
+
+## 2023.08.10
+
+
+### Fixed
+
+- Corrected 'or' translation to pt-br ([#4507](https://github.com/cookiecutter/cookiecutter-django/pull/4507))
+
+## 2023.08.04
+
+
+### Updated
+
+- Auto-update pre-commit hooks ([#4503](https://github.com/cookiecutter/cookiecutter-django/pull/4503))
+
+## 2023.08.01
+
+
+### Updated
+
+- Auto-update pre-commit hooks ([#4499](https://github.com/cookiecutter/cookiecutter-django/pull/4499))
+
+- Update django-anymail to 10.1 ([#4497](https://github.com/cookiecutter/cookiecutter-django/pull/4497))
+
+- Update sentry-sdk to 1.29.2 ([#4496](https://github.com/cookiecutter/cookiecutter-django/pull/4496))
+
+- Update django to 4.2.4 ([#4495](https://github.com/cookiecutter/cookiecutter-django/pull/4495))
+
+- Update flake8 to 6.1.0 ([#4489](https://github.com/cookiecutter/cookiecutter-django/pull/4489))
+
+- Update uvicorn to 0.23.2 ([#4490](https://github.com/cookiecutter/cookiecutter-django/pull/4490))
+
+- Update sentry-sdk to 1.29.1 ([#4494](https://github.com/cookiecutter/cookiecutter-django/pull/4494))
+
+## 2023.07.30
+
+
+### Fixed
+
+- Fix `README.md` file extension in `setup.py` ([#4488](https://github.com/cookiecutter/cookiecutter-django/pull/4488))
+
+## 2023.07.28
+
+
+### Changed
+
+- Add support for Drone CI ([#4382](https://github.com/cookiecutter/cookiecutter-django/pull/4382))
+
+## 2023.07.27
+
+
+### Documentation
+
+- Document that `docker exec` does not work for running management commands ([#4487](https://github.com/cookiecutter/cookiecutter-django/pull/4487))
+
+- Add Webpack instructions for developping locally with HTTPS ([#4486](https://github.com/cookiecutter/cookiecutter-django/pull/4486))
+
+## 2023.07.25
+
+
+### Updated
+
+- Upgrade to traefik 2.10.4 ([#4483](https://github.com/cookiecutter/cookiecutter-django/pull/4483))
+
+## 2023.07.24
+
+
+### Fixed
+
+- Add missing custom CRSF error page in prod ([#4464](https://github.com/cookiecutter/cookiecutter-django/pull/4464))
+
+### Documentation
+
+- Replace `docker-compose` by `docker compose` in docs ([#4463](https://github.com/cookiecutter/cookiecutter-django/pull/4463))
+
+### Updated
+
+- Update drf-spectacular to 0.26.4 ([#4481](https://github.com/cookiecutter/cookiecutter-django/pull/4481))
+
+## 2023.07.20
+
+
+### Updated
+
+- Update djlint to 1.32.1 ([#4475](https://github.com/cookiecutter/cookiecutter-django/pull/4475))
+
+## 2023.07.19
+
+
+### Updated
+
+- Update factory-boy to 3.3.0 ([#4472](https://github.com/cookiecutter/cookiecutter-django/pull/4472))
+
+- Update gunicorn to 21.2.0 ([#4473](https://github.com/cookiecutter/cookiecutter-django/pull/4473))
+
+- Update djlint to 1.32.0 ([#4471](https://github.com/cookiecutter/cookiecutter-django/pull/4471))
+
+## 2023.07.18
+
+
+### Updated
+
+- Update gunicorn to 21.1.0 ([#4470](https://github.com/cookiecutter/cookiecutter-django/pull/4470))
+
+- Update uvicorn to 0.23.1 ([#4468](https://github.com/cookiecutter/cookiecutter-django/pull/4468))
+
+- Update gunicorn to 21.0.1 ([#4466](https://github.com/cookiecutter/cookiecutter-django/pull/4466))
+
## 2023.07.13
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index ea54113d2..c1d85202a 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -796,6 +796,13 @@ Listed in alphabetical order.
fabaff |
+
+ Fateme Fouladkar |
+
+ FatemeFouladkar
+ |
+ |
+
Felipe Arruda |
@@ -936,6 +943,13 @@ Listed in alphabetical order.
|
|
+
+ hleroy |
+
+ hleroy
+ |
+ |
+
Hoai-Thu Vuong |
@@ -957,6 +971,13 @@ Listed in alphabetical order.
|
|
+
+ Imran Rahman |
+
+ infraredCoding
+ |
+ |
+
innicoder |
@@ -1447,6 +1468,13 @@ Listed in alphabetical order.
|
|
+
+ MinWoo Sung |
+
+ SungMinWoo
+ |
+ |
+
monosans |
@@ -1685,6 +1713,13 @@ Listed in alphabetical order.
|
|
+
+ Sadra Yahyapour |
+
+ lnxpy
+ |
+ lnxpylnxpy |
+
Sam Collins |
@@ -1706,6 +1741,13 @@ Listed in alphabetical order.
|
sebastianreyese |
+
+ Shayan Karimi |
+
+ shywn-mrk
+ |
+ shywn_mrk |
+
Simon Rey |
@@ -1790,6 +1832,13 @@ Listed in alphabetical order.
|
|
+
+ Tharushan |
+
+ Tharushan
+ |
+ |
+
Thibault J. |
@@ -2000,6 +2049,13 @@ Listed in alphabetical order.
|
|
+
+ zhaoruibing |
+
+ zhaoruibing
+ |
+ |
+
### Special Thanks
diff --git a/README.md b/README.md
index 0a39fb084..7f2c358e7 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ production-ready Django projects quickly.
- Works with Python 3.11
- Renders Django projects with 100% starting test coverage
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
-- [12-Factor](http://12factor.net/) based settings via [django-environ](https://github.com/joke2k/django-environ)
+- [12-Factor](https://12factor.net) based settings via [django-environ](https://github.com/joke2k/django-environ)
- Secure by default. We believe in SSL.
- Optimized development and production settings
- Registration via [django-allauth](https://github.com/pennersr/django-allauth)
@@ -247,6 +247,7 @@ experience better.
## Articles
+- [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
- [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
diff --git a/cookiecutter.json b/cookiecutter.json
index 3fcab4a78..f66e281f5 100644
--- a/cookiecutter.json
+++ b/cookiecutter.json
@@ -39,7 +39,7 @@
"use_sentry": "n",
"use_whitenoise": "n",
"use_heroku": "n",
- "ci_tool": ["None", "Travis", "Gitlab", "Github"],
+ "ci_tool": ["None", "Travis", "Gitlab", "Github", "Drone"],
"keep_local_envs_in_vcs": "y",
"debug": "n"
}
diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst
index c1b8c6d7b..3d2f9f813 100644
--- a/docs/deployment-with-docker.rst
+++ b/docs/deployment-with-docker.rst
@@ -1,7 +1,7 @@
Deployment with Docker
======================
-.. index:: deployment, docker, docker-compose, compose
+.. index:: deployment, docker, docker compose, compose
Prerequisites
@@ -89,7 +89,7 @@ You can read more about this feature and how to configure it, at `Automatic HTTP
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:
+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``
@@ -107,7 +107,7 @@ To solve this, you can either:
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``.
+ 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.
@@ -122,42 +122,42 @@ Building & Running Production Stack
You will need to build the stack first. To do that, run::
- docker-compose -f production.yml build
+ docker compose -f production.yml build
Once this is ready, you can run it with::
- docker-compose -f production.yml up
+ docker compose -f production.yml up
To run the stack and detach the containers, run::
- docker-compose -f production.yml up -d
+ docker compose -f production.yml up -d
To run a migration, open up a second terminal and run::
- docker-compose -f production.yml run --rm django python manage.py migrate
+ docker compose -f production.yml run --rm django python manage.py migrate
To create a superuser, run::
- docker-compose -f production.yml run --rm django python manage.py createsuperuser
+ docker compose -f production.yml run --rm django python manage.py createsuperuser
If you need a shell, run::
- docker-compose -f production.yml run --rm django python manage.py shell
+ docker compose -f production.yml run --rm django python manage.py shell
To check the logs out, run::
- docker-compose -f production.yml logs
+ docker compose -f production.yml logs
If you want to scale your application, run::
- docker-compose -f production.yml up --scale django=4
- docker-compose -f production.yml up --scale celeryworker=2
+ docker compose -f production.yml up --scale django=4
+ docker compose -f production.yml up --scale celeryworker=2
.. warning:: don't try to scale ``postgres``, ``celerybeat``, or ``traefik``.
To see how your containers are doing run::
- docker-compose -f production.yml ps
+ docker compose -f production.yml ps
Example: Supervisor
@@ -165,12 +165,12 @@ Example: Supervisor
Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
-it needs to do is to run ``docker-compose -f production.yml up`` in your projects root directory.
+it needs to do is to run ``docker compose -f production.yml up`` in your projects root directory.
If you are using ``supervisor``, you can use this file as a starting point::
[program:{{cookiecutter.project_slug}}]
- command=docker-compose -f production.yml up
+ command=docker compose -f production.yml up
directory=/path/to/{{cookiecutter.project_slug}}
redirect_stderr=true
autostart=true
diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst
index 680f249dd..6af4fe7c2 100644
--- a/docs/developing-locally-docker.rst
+++ b/docs/developing-locally-docker.rst
@@ -32,7 +32,7 @@ Build the Stack
This can take a while, especially the first time you run this particular command on your development system::
- $ docker-compose -f local.yml build
+ $ docker compose -f local.yml build
Generally, if you want to emulate production environment use ``production.yml`` instead. And this is true for any other actions you might need to perform: whenever a switch is required, just do it!
@@ -51,7 +51,7 @@ This brings up both Django and PostgreSQL. The first time it is run it might tak
Open a terminal at the project root and run the following for local development::
- $ docker-compose -f local.yml up
+ $ docker compose -f local.yml up
You can also set the environment variable ``COMPOSE_FILE`` pointing to ``local.yml`` like this::
@@ -59,11 +59,11 @@ You can also set the environment variable ``COMPOSE_FILE`` pointing to ``local.y
And then run::
- $ docker-compose up
+ $ docker compose up
To run in a detached (background) mode, just::
- $ docker-compose up -d
+ $ docker compose up -d
The site should start and be accessible at http://localhost:3000 if you selected Webpack or Gulp as frontend pipeline and http://localhost:8000 otherwise.
@@ -71,13 +71,13 @@ The site should start and be accessible at http://localhost:3000 if you selected
Execute Management Commands
---------------------------
-As with any shell command that we wish to run in our container, this is done using the ``docker-compose -f local.yml run --rm`` command: ::
+As with any shell command that we wish to run in our container, this is done using the ``docker compose -f local.yml run --rm`` command: ::
- $ docker-compose -f local.yml run --rm django python manage.py migrate
- $ docker-compose -f local.yml run --rm django python manage.py createsuperuser
+ $ docker compose -f local.yml run --rm django python manage.py migrate
+ $ docker compose -f local.yml run --rm django python manage.py createsuperuser
Here, ``django`` is the target service we are executing the commands against.
-
+Also, please note that the ``docker exec`` does not work for running management commands.
(Optionally) Designate your Docker Development Server IP
--------------------------------------------------------
@@ -156,8 +156,8 @@ You have to modify the relevant requirement file: base, local or production by a
To get this change picked up, you'll need to rebuild the image(s) and restart the running container: ::
- docker-compose -f local.yml build
- docker-compose -f local.yml up
+ docker compose -f local.yml build
+ docker compose -f local.yml up
Debugging
~~~~~~~~~
@@ -171,7 +171,7 @@ If you are using the following within your code to debug: ::
Then you may need to run the following for it to work as desired: ::
- $ docker-compose -f local.yml run --rm --service-ports django
+ $ docker compose -f local.yml run --rm --service-ports django
django-debug-toolbar
@@ -316,7 +316,7 @@ You should allow the new hostname. ::
Rebuild your ``docker`` application. ::
- $ docker-compose -f local.yml up -d --build
+ $ docker compose -f local.yml up -d --build
Go to your browser and type in your URL bar ``https://my-dev-env.local``
@@ -330,3 +330,26 @@ See `https with nginx`_ for more information on this configuration.
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 ``local.yml``, change ``depends_on`` to ``node`` instead of ``django``.
+
+2. On the ``node`` service in ``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`
+ },
diff --git a/docs/docker-postgres-backups.rst b/docs/docker-postgres-backups.rst
index 875d737eb..c40b6fd69 100644
--- a/docs/docker-postgres-backups.rst
+++ b/docs/docker-postgres-backups.rst
@@ -8,7 +8,7 @@ Prerequisites
-------------
#. the project was generated with ``use_docker`` set to ``y``;
-#. the stack is up and running: ``docker-compose -f local.yml up -d postgres``.
+#. the stack is up and running: ``docker compose -f local.yml up -d postgres``.
Creating a Backup
@@ -16,7 +16,7 @@ Creating a Backup
To create a backup, run::
- $ docker-compose -f local.yml exec postgres backup
+ $ docker compose -f local.yml exec postgres backup
Assuming your project's database is named ``my_project`` here is what you will see: ::
@@ -31,7 +31,7 @@ Viewing the Existing Backups
To list existing backups, ::
- $ docker-compose -f local.yml exec postgres backups
+ $ docker compose -f local.yml exec postgres backups
These are the sample contents of ``/backups``: ::
@@ -55,9 +55,9 @@ With a single backup file copied to ``.`` that would be ::
$ docker cp 9c5c3f055843:/backups/backup_2018_03_13T09_05_07.sql.gz .
-You can also get the container ID using ``docker-compose -f local.yml ps -q postgres`` so if you want to automate your backups, you don't have to check the container ID manually every time. Here is the full command ::
+You can also get the container ID using ``docker compose -f local.yml ps -q postgres`` so if you want to automate your backups, you don't have to check the container ID manually every time. Here is the full command ::
- $ docker cp $(docker-compose -f local.yml ps -q postgres):/backups ./backups
+ $ docker cp $(docker compose -f local.yml ps -q postgres):/backups ./backups
.. _`command`: https://docs.docker.com/engine/reference/commandline/cp/
@@ -66,7 +66,7 @@ Restoring from the Existing Backup
To restore from one of the backups you have already got (take the ``backup_2018_03_13T09_05_07.sql.gz`` for example), ::
- $ docker-compose -f local.yml exec postgres restore backup_2018_03_13T09_05_07.sql.gz
+ $ docker compose -f local.yml exec postgres restore backup_2018_03_13T09_05_07.sql.gz
You will see something like ::
@@ -94,5 +94,5 @@ Backup to Amazon S3
----------------------------------
For uploading your backups to Amazon S3 you can use the aws cli container. There is an upload command for uploading the postgres /backups directory recursively and there is a download command for downloading a specific backup. The default S3 environment variables are used. ::
- $ docker-compose -f production.yml run --rm awscli upload
- $ docker-compose -f production.yml run --rm awscli download backup_2018_03_13T09_05_07.sql.gz
+ $ docker compose -f production.yml run --rm awscli upload
+ $ docker compose -f production.yml run --rm awscli download backup_2018_03_13T09_05_07.sql.gz
diff --git a/docs/document.rst b/docs/document.rst
index 974c66c69..26f5d56a1 100644
--- a/docs/document.rst
+++ b/docs/document.rst
@@ -11,7 +11,7 @@ After you have set up to `develop locally`_, run the following command from the
If you set up your project to `develop locally with docker`_, run the following command: ::
- $ docker-compose -f local.yml up docs
+ $ docker compose -f local.yml up docs
Navigate to port 9000 on your host to see the documentation. This will be opened automatically at `localhost`_ for local, non-docker development.
diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst
index edf2306d4..bd368ae84 100644
--- a/docs/project-generation-options.rst
+++ b/docs/project-generation-options.rst
@@ -135,6 +135,7 @@ ci_tool:
2. `Travis CI`_
3. `Gitlab CI`_
4. `Github Actions`_
+ 5. `Drone CI`_
keep_local_envs_in_vcs:
Indicates whether the project's ``.envs/.local/`` should be kept in VCS
@@ -196,4 +197,6 @@ debug:
.. _GitLab CI: https://docs.gitlab.com/ee/ci/
+.. _Drone CI: https://docs.drone.io/pipeline/overview/
+
.. _Github Actions: https://docs.github.com/en/actions
diff --git a/docs/testing.rst b/docs/testing.rst
index bea45c6dd..6387a6e1e 100644
--- a/docs/testing.rst
+++ b/docs/testing.rst
@@ -19,7 +19,7 @@ You will get a readout of the `users` app that has already been set up with test
If you set up your project to `develop locally with docker`_, run the following command: ::
- $ docker-compose -f local.yml run --rm django pytest
+ $ docker compose -f local.yml run --rm django pytest
Targeting particular apps for testing in ``docker`` follows a similar pattern as previously shown above.
@@ -36,8 +36,8 @@ Once the tests are complete, in order to see the code coverage, run the followin
If you're running the project locally with Docker, use these commands instead: ::
- $ docker-compose -f local.yml run --rm django coverage run -m pytest
- $ docker-compose -f local.yml run --rm django coverage report
+ $ docker compose -f local.yml run --rm django coverage run -m pytest
+ $ docker compose -f local.yml run --rm django coverage report
.. note::
diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst
index 293e9b652..80bab2e29 100644
--- a/docs/troubleshooting.rst
+++ b/docs/troubleshooting.rst
@@ -24,13 +24,13 @@ Examples of logs::
If you recreate the project multiple times with the same name, Docker would preserve the volumes for the postgres container between projects. Here is what happens:
#. You generate the project the first time. The .env postgres file is populated with the random password
-#. You run the docker-compose and the containers are created. The postgres container creates the database based on the .env file credentials
+#. You run the docker compose and the containers are created. The postgres container creates the database based on the .env file credentials
#. You "regenerate" the project with the same name, so the postgres .env file is populated with a new random password
-#. You run docker-compose. Since the names of the containers are the same, docker will try to start them (not create them from scratch i.e. it won't execute the Dockerfile to recreate the database). When this happens, it tries to start the database based on the new credentials which do not match the ones that the database was created with, and you get the error message above.
+#. You run docker compose. Since the names of the containers are the same, docker will try to start them (not create them from scratch i.e. it won't execute the Dockerfile to recreate the database). When this happens, it tries to start the database based on the new credentials which do not match the ones that the database was created with, and you get the error message above.
To fix this, you can either:
-- Clear your project-related Docker cache with ``docker-compose -f local.yml down --volumes --rmi all``.
+- Clear your project-related Docker cache with ``docker compose -f local.yml down --volumes --rmi all``.
- Use the Docker volume sub-commands to find volumes (`ls`_) and remove them (`rm`_).
- Use the `prune`_ command to clear system-wide (use with care!).
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
index a913f7592..37f96efc0 100644
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -183,6 +183,7 @@ def handle_js_runner(choice, use_docker, use_async):
"browser-sync",
"cssnano",
"gulp",
+ "gulp-concat",
"gulp-imagemin",
"gulp-plumber",
"gulp-postcss",
@@ -207,6 +208,24 @@ def handle_js_runner(choice, use_docker, use_async):
remove_gulp_files()
+def remove_prettier_pre_commit():
+ with open(".pre-commit-config.yaml", "r") as fd:
+ content = fd.readlines()
+
+ removing = False
+ new_lines = []
+ for line in content:
+ if removing and "- repo:" in line:
+ removing = False
+ if "mirrors-prettier" in line:
+ removing = True
+ if not removing:
+ new_lines.append(line)
+
+ with open(".pre-commit-config.yaml", "w") as fd:
+ fd.writelines(new_lines)
+
+
def remove_celery_files():
file_names = [
os.path.join("config", "celery_app.py"),
@@ -238,6 +257,10 @@ def remove_dotgithub_folder():
shutil.rmtree(".github")
+def remove_dotdrone_file():
+ os.remove(".drone.yml")
+
+
def generate_random_string(length, using_digits=False, using_ascii_letters=False, using_punctuation=False):
"""
Example:
@@ -461,6 +484,7 @@ def main():
remove_webpack_files()
remove_sass_files()
remove_packagejson_file()
+ remove_prettier_pre_commit()
if "{{ cookiecutter.use_docker }}".lower() == "y":
remove_node_dockerfile()
else:
@@ -491,6 +515,9 @@ def main():
if "{{ cookiecutter.ci_tool }}" != "Github":
remove_dotgithub_folder()
+ if "{{ cookiecutter.ci_tool }}" != "Drone":
+ remove_dotdrone_file()
+
if "{{ cookiecutter.use_drf }}".lower() == "n":
remove_drf_starter_files()
diff --git a/requirements.txt b/requirements.txt
index 48f5f54fc..da008e6f4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,28 +1,28 @@
-cookiecutter==2.2.3
-sh==2.0.4; sys_platform != "win32"
+cookiecutter==2.3.0
+sh==2.0.6; sys_platform != "win32"
binaryornot==0.4.4
# Code quality
# ------------------------------------------------------------------------------
black==23.7.0
isort==5.12.0
-flake8==6.0.0
-django-upgrade==1.14.0
-djlint==1.31.1
+flake8==6.1.0
+django-upgrade==1.14.1
+djlint==1.32.1
pre-commit==3.3.3
# Testing
# ------------------------------------------------------------------------------
-tox==4.6.4
+tox==4.9.0
pytest==7.4.0
pytest-xdist==3.3.1
pytest-cookies==0.7.0
pytest-instafail==0.5.0
-pyyaml==6.0
+pyyaml==6.0.1
# Scripting
# ------------------------------------------------------------------------------
-PyGithub==1.59.0
+PyGithub==1.59.1
gitpython==3.1.32
jinja2==3.1.2
requests==2.31.0
diff --git a/setup.py b/setup.py
index c64011e68..e47cc72ae 100644
--- a/setup.py
+++ b/setup.py
@@ -5,9 +5,9 @@ except ImportError:
from distutils.core import setup
# We use calendar versioning
-version = "2023.07.13"
+version = "2023.08.19"
-with open("README.rst") as readme_file:
+with open("README.md") as readme_file:
long_description = readme_file.read()
setup(
diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py
index 2eb7ae52e..87e52ef01 100755
--- a/tests/test_cookiecutter_generation.py
+++ b/tests/test_cookiecutter_generation.py
@@ -127,6 +127,7 @@ SUPPORTED_COMBINATIONS = [
{"ci_tool": "Travis"},
{"ci_tool": "Gitlab"},
{"ci_tool": "Github"},
+ {"ci_tool": "Drone"},
{"keep_local_envs_in_vcs": "y"},
{"keep_local_envs_in_vcs": "n"},
{"debug": "y"},
@@ -271,7 +272,7 @@ def test_djlint_check_passes(cookies, context_override):
["use_docker", "expected_test_script"],
[
("n", "pytest"),
- ("y", "docker-compose -f local.yml run django pytest"),
+ ("y", "docker compose -f local.yml run django pytest"),
],
)
def test_travis_invokes_pytest(cookies, context, use_docker, expected_test_script):
@@ -296,7 +297,7 @@ def test_travis_invokes_pytest(cookies, context, use_docker, expected_test_scrip
["use_docker", "expected_test_script"],
[
("n", "pytest"),
- ("y", "docker-compose -f local.yml run django pytest"),
+ ("y", "docker compose -f local.yml run django pytest"),
],
)
def test_gitlab_invokes_precommit_and_pytest(cookies, context, use_docker, expected_test_script):
@@ -323,7 +324,7 @@ def test_gitlab_invokes_precommit_and_pytest(cookies, context, use_docker, expec
["use_docker", "expected_test_script"],
[
("n", "pytest"),
- ("y", "docker-compose -f local.yml run django pytest"),
+ ("y", "docker compose -f local.yml run django pytest"),
],
)
def test_github_invokes_linter_and_pytest(cookies, context, use_docker, expected_test_script):
diff --git a/tests/test_docker.sh b/tests/test_docker.sh
index 5c60d20d3..8e4055e20 100755
--- a/tests/test_docker.sh
+++ b/tests/test_docker.sh
@@ -15,28 +15,28 @@ cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y "$@"
cd my_awesome_project
# make sure all images build
-docker-compose -f local.yml build
+docker compose -f local.yml build
# run the project's type checks
-docker-compose -f local.yml run django mypy my_awesome_project
+docker compose -f local.yml run django mypy my_awesome_project
# run the project's tests
-docker-compose -f local.yml run django pytest
+docker compose -f local.yml run django pytest
# return non-zero status code if there are migrations that have not been created
-docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
+docker compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
# Test support for translations
-docker-compose -f local.yml run django python manage.py makemessages --all
+docker compose -f local.yml run django python manage.py makemessages --all
# Make sure the check doesn't raise any warnings
-docker-compose -f local.yml run django python manage.py check --fail-level WARNING
+docker compose -f local.yml run django python manage.py check --fail-level WARNING
# Generate the HTML for the documentation
-docker-compose -f local.yml run docs make html
+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
+ docker compose -f local.yml run node npm run build
fi
diff --git a/{{cookiecutter.project_slug}}/.devcontainer/devcontainer.json b/{{cookiecutter.project_slug}}/.devcontainer/devcontainer.json
index 6ec731ce5..393408582 100644
--- a/{{cookiecutter.project_slug}}/.devcontainer/devcontainer.json
+++ b/{{cookiecutter.project_slug}}/.devcontainer/devcontainer.json
@@ -24,7 +24,7 @@
],
// Tells devcontainer.json supporting services / tools whether they should run
// /bin/sh -c "while sleep 1000; do :; done" when starting the container instead of the container’s default command
- "overrideCommand": true,
+ "overrideCommand": false,
"service": "django",
// "remoteEnv": {"PATH": "/home/dev-user/.local/bin:${containerEnv:PATH}"},
"remoteUser": "dev-user",
diff --git a/{{cookiecutter.project_slug}}/.dockerignore b/{{cookiecutter.project_slug}}/.dockerignore
index 7369480e3..a602416cd 100644
--- a/{{cookiecutter.project_slug}}/.dockerignore
+++ b/{{cookiecutter.project_slug}}/.dockerignore
@@ -9,3 +9,4 @@
.travis.yml
venv
.git
+.envs/
diff --git a/{{cookiecutter.project_slug}}/.drone.yml b/{{cookiecutter.project_slug}}/.drone.yml
new file mode 100644
index 000000000..dc08bfbab
--- /dev/null
+++ b/{{cookiecutter.project_slug}}/.drone.yml
@@ -0,0 +1,48 @@
+kind: pipeline
+name: default
+
+environment:
+ POSTGRES_USER: '{{ cookiecutter.project_slug }}'
+ POSTGRES_PASSWORD: ''
+ POSTGRES_DB: 'test_{{ cookiecutter.project_slug }}'
+ POSTGRES_HOST_AUTH_METHOD: trust
+ {%- if cookiecutter.use_celery == 'y' %}
+ CELERY_BROKER_URL: 'redis://redis:6379/0'
+ {%- endif %}
+
+steps:
+- name: lint
+ pull: if-not-exists
+ image: python:3.11
+ environment:
+ PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
+ volumes:
+ - name: pre-commit cache
+ path: ${PRE_COMMIT_HOME}
+ commands:
+ - export PRE_COMMIT_HOME=$CI_PROJECT_DIR/.cache/pre-commit
+ - pip install -q pre-commit
+ - pre-commit run --show-diff-on-failure --color=always --all-files
+
+- name: test
+ pull: if-not-exists
+ {%- if cookiecutter.use_docker == 'y' %}
+ image: docker/compose:1.29.2
+ environment:
+ DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
+ commands:
+ - docker-compose -f local.yml build
+ - docker-compose -f local.yml run --rm django python manage.py migrate
+ - docker-compose -f local.yml up -d
+ - docker-compose -f local.yml run django pytest
+ {%- else %}
+ image: python:3.11
+ commands:
+ - pip install -r requirements/local.txt
+ - pytest
+ {%- endif%}
+
+volumes:
+- name: pre-commit cache
+ host:
+ path: /tmp/drone/cache/pre-commit
diff --git a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml
index 8f9824e8f..3a863ccb9 100644
--- a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml
+++ b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml
@@ -69,16 +69,16 @@ jobs:
{%- if cookiecutter.use_docker == 'y' %}
- name: Build the Stack
- run: docker-compose -f local.yml build
+ run: docker compose -f local.yml build
- name: Run DB Migrations
- run: docker-compose -f local.yml run --rm django python manage.py migrate
+ run: docker compose -f local.yml run --rm django python manage.py migrate
- name: Run Django Tests
- run: docker-compose -f local.yml run django pytest
+ run: docker compose -f local.yml run django pytest
- name: Tear down the Stack
- run: docker-compose -f local.yml down
+ run: docker compose -f local.yml down
{%- else %}
- name: Set up Python
diff --git a/{{cookiecutter.project_slug}}/.gitlab-ci.yml b/{{cookiecutter.project_slug}}/.gitlab-ci.yml
index a312a41ae..350212003 100644
--- a/{{cookiecutter.project_slug}}/.gitlab-ci.yml
+++ b/{{cookiecutter.project_slug}}/.gitlab-ci.yml
@@ -33,12 +33,12 @@ pytest:
services:
- docker:dind
before_script:
- - docker-compose -f local.yml build
+ - docker compose -f local.yml build
# Ensure celerybeat does not crash due to non-existent tables
- - docker-compose -f local.yml run --rm django python manage.py migrate
- - docker-compose -f local.yml up -d
+ - docker compose -f local.yml run --rm django python manage.py migrate
+ - docker compose -f local.yml up -d
script:
- - docker-compose -f local.yml run django pytest
+ - docker compose -f local.yml run django pytest
{%- else %}
image: python:3.11
tags:
diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
index 0d1265ac2..0b68f4e2b 100644
--- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
+++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
@@ -16,30 +16,28 @@ repos:
- id: check-case-conflict
- id: check-docstring-first
- id: detect-private-key
-{%- if cookiecutter.frontend_pipeline in ["Webpack", "Gulp"] %}
- repo: https://github.com/pre-commit/mirrors-prettier
- rev: v3.0.0-alpha.9-for-vscode
+ rev: v3.0.2
hooks:
- id: prettier
args: ['--tab-width', '2', '--single-quote']
exclude: '{{cookiecutter.project_slug}}/templates/'
-{%- endif %}
- repo: https://github.com/adamchainz/django-upgrade
- rev: '1.14.0'
+ rev: '1.14.1'
hooks:
- id: django-upgrade
args: ['--target-version', '4.2']
- repo: https://github.com/asottile/pyupgrade
- rev: v3.7.0
+ rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/psf/black
- rev: 23.3.0
+ rev: 23.7.0
hooks:
- id: black
@@ -49,12 +47,12 @@ repos:
- id: isort
- repo: https://github.com/PyCQA/flake8
- rev: 6.0.0
+ rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/Riverside-Healthcare/djLint
- rev: v1.31.1
+ rev: v1.32.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
diff --git a/{{cookiecutter.project_slug}}/.travis.yml b/{{cookiecutter.project_slug}}/.travis.yml
index 5e5f92ff5..cd703d3ad 100644
--- a/{{cookiecutter.project_slug}}/.travis.yml
+++ b/{{cookiecutter.project_slug}}/.travis.yml
@@ -17,16 +17,16 @@ jobs:
- name: "Django Test"
{%- if cookiecutter.use_docker == 'y' %}
before_script:
- - docker-compose -v
+ - docker compose -v
- docker -v
- - docker-compose -f local.yml build
+ - docker compose -f local.yml build
# Ensure celerybeat does not crash due to non-existent tables
- - docker-compose -f local.yml run --rm django python manage.py migrate
- - docker-compose -f local.yml up -d
+ - docker compose -f local.yml run --rm django python manage.py migrate
+ - docker compose -f local.yml up -d
script:
- - "docker-compose -f local.yml run django pytest"
+ - "docker compose -f local.yml run django pytest"
after_failure:
- - docker-compose -f local.yml logs
+ - docker compose -f local.yml logs
{%- else %}
before_install:
- sudo apt-get update -qq
diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile
index 3636ce1ef..67571feed 100644
--- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile
+++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile
@@ -1,5 +1,5 @@
# define an alias for the specific python version used in this file.
-FROM python:3.11.4-slim-bullseye as python
+FROM python:3.11.5-slim-bullseye as python
# Python build stage
FROM python as python-build-stage
diff --git a/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile
index f9895a083..1652ac2ce 100644
--- a/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile
+++ b/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile
@@ -1,5 +1,5 @@
# define an alias for the specific python version used in this file.
-FROM python:3.11.4-slim-bullseye as python
+FROM python:3.11.5-slim-bullseye as python
# Python build stage
diff --git a/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/download b/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/download
index 0c515935f..9561d917a 100644
--- a/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/download
+++ b/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/download
@@ -3,7 +3,7 @@
### Download a file from your Amazon S3 bucket to the postgres /backups folder
###
### Usage:
-### $ docker-compose -f production.yml run --rm awscli <1>
+### $ docker compose -f production.yml run --rm awscli <1>
set -o errexit
set -o pipefail
diff --git a/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/upload b/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/upload
index 9446b9304..73c1b9bec 100644
--- a/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/upload
+++ b/{{cookiecutter.project_slug}}/compose/production/aws/maintenance/upload
@@ -3,7 +3,7 @@
### Upload the /backups folder to Amazon S3
###
### Usage:
-### $ docker-compose -f production.yml run --rm awscli upload
+### $ docker compose -f production.yml run --rm awscli upload
set -o errexit
set -o pipefail
diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile
index a48cbc4af..49950b9af 100644
--- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile
+++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile
@@ -25,7 +25,7 @@ RUN npm run build
{%- endif %}
# define an alias for the specific python version used in this file.
-FROM python:3.11.4-slim-bullseye as python
+FROM python:3.11.5-slim-bullseye as python
# Python build stage
FROM python as python-build-stage
diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup
index ee0c9d63c..f72304c05 100644
--- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup
+++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backup
@@ -4,7 +4,7 @@
### Create a database backup.
###
### Usage:
-### $ docker-compose -f .yml (exec |run --rm) postgres backup
+### $ docker compose -f .yml (exec |run --rm) postgres backup
set -o errexit
diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backups b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backups
index 0484ccff5..a18937d62 100644
--- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backups
+++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/backups
@@ -4,7 +4,7 @@
### View backups.
###
### Usage:
-### $ docker-compose -f .yml (exec |run --rm) postgres backups
+### $ docker compose -f .yml (exec |run --rm) postgres backups
set -o errexit
diff --git a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore
index 9661ca7f1..c68f17d71 100644
--- a/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore
+++ b/{{cookiecutter.project_slug}}/compose/production/postgres/maintenance/restore
@@ -7,7 +7,7 @@
### <1> filename of an existing backup.
###
### Usage:
-### $ docker-compose -f .yml (exec |run --rm) postgres restore <1>
+### $ docker compose -f .yml (exec |run --rm) postgres restore <1>
set -o errexit
diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile
index bdedff720..e547dfbb8 100644
--- a/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile
+++ b/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile
@@ -1,4 +1,4 @@
-FROM traefik:2.10.3
+FROM traefik:2.10.4
RUN mkdir -p /etc/traefik/acme \
&& touch /etc/traefik/acme/acme.json \
&& chmod 600 /etc/traefik/acme/acme.json
diff --git a/{{cookiecutter.project_slug}}/docs/howto.rst b/{{cookiecutter.project_slug}}/docs/howto.rst
index 7f2d26a1e..7d86351cf 100644
--- a/{{cookiecutter.project_slug}}/docs/howto.rst
+++ b/{{cookiecutter.project_slug}}/docs/howto.rst
@@ -8,14 +8,14 @@ Documentation can be written as rst files in `{{cookiecutter.project_slug}}/docs
{% if cookiecutter.use_docker == 'n' %}
To build and serve docs, use the command::
-
- make livehtml
-
-from inside the `{{cookiecutter.project_slug}}/docs` directory.
+
+ make livehtml
+
+from inside the `{{cookiecutter.project_slug}}/docs` directory.
{% else %}
To build and serve docs, use the commands::
-
- docker-compose -f local.yml up docs
+
+ docker compose -f local.yml up docs
{% endif %}
@@ -34,12 +34,12 @@ For an in-use example, see the `page source <_sources/users.rst.txt>`_ for :ref:
To compile all docstrings automatically into documentation source files, use the command:
::
-
+
make apidocs
{% if cookiecutter.use_docker == 'y' %}
This can be done in the docker container:
- ::
-
+ ::
+
docker run --rm docs make apidocs
{% endif -%}
diff --git a/{{cookiecutter.project_slug}}/locale/README.md b/{{cookiecutter.project_slug}}/locale/README.md
index b2a8a0ef2..a514ad10c 100644
--- a/{{cookiecutter.project_slug}}/locale/README.md
+++ b/{{cookiecutter.project_slug}}/locale/README.md
@@ -3,7 +3,7 @@
Start by configuring the `LANGUAGES` settings in `base.py`, by uncommenting languages you are willing to support. Then, translations strings will be placed in this folder when running:
```bash
-{% if cookiecutter.use_docker == 'y' %}docker-compose -f local.yml run --rm django {% endif %}python manage.py makemessages -all --no-location
+{% if cookiecutter.use_docker == 'y' %}docker compose -f local.yml run --rm django {% endif %}python manage.py makemessages -all --no-location
```
This should generate `django.po` (stands for Portable Object) files under each locale `/LC_MESSAGES/django.po`. Each translatable string in the codebase is collected with its `msgid` and need to be translated as `msgstr`, for example:
@@ -16,7 +16,7 @@ msgstr "utilisateurs"
Once all translations are done, they need to be compiled into `.mo` files (stands for Machine Object), which are the actual binary files used by the application:
```bash
-{% if cookiecutter.use_docker == 'y' %}docker-compose -f local.yml run --rm django {% endif %}python manage.py compilemessages
+{% if cookiecutter.use_docker == 'y' %}docker compose -f local.yml run --rm django {% endif %}python manage.py compilemessages
```
Note that the `.po` files are NOT used by the application directly, so if the `.mo` files are out of dates, the content won't appear as translated even if the `.po` files are up-to-date.
diff --git a/{{cookiecutter.project_slug}}/locale/pt_BR/LC_MESSAGES/django.po b/{{cookiecutter.project_slug}}/locale/pt_BR/LC_MESSAGES/django.po
index 2556abba8..1681e0f57 100644
--- a/{{cookiecutter.project_slug}}/locale/pt_BR/LC_MESSAGES/django.po
+++ b/{{cookiecutter.project_slug}}/locale/pt_BR/LC_MESSAGES/django.po
@@ -127,7 +127,7 @@ msgstr "Ou, cadastre-se para uma conta em %(site_
#: {{cookiecutter.project_slug}}/templates/account/login.html:32
msgid "or"
-msgstr "or"
+msgstr "ou"
#: {{cookiecutter.project_slug}}/templates/account/login.html:41
#, python-format
diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt
index 64eca4f52..bf5bfde69 100644
--- a/{{cookiecutter.project_slug}}/requirements/base.txt
+++ b/{{cookiecutter.project_slug}}/requirements/base.txt
@@ -7,11 +7,11 @@ rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/n
rcssmin==1.1.1 # https://github.com/ndparker/rcssmin
{%- endif %}
{%- endif %}
-argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
+argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi
{%- if cookiecutter.use_whitenoise == 'y' %}
whitenoise==6.5.0 # https://github.com/evansd/whitenoise
{%- endif %}
-redis==4.6.0 # https://github.com/redis/redis-py
+redis==5.0.0 # https://github.com/redis/redis-py
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
hiredis==2.2.3 # https://github.com/redis/hiredis-py
{%- endif %}
@@ -19,19 +19,19 @@ hiredis==2.2.3 # https://github.com/redis/hiredis-py
celery==5.3.1 # pyup: < 6.0 # https://github.com/celery/celery
django-celery-beat==2.5.0 # https://github.com/celery/django-celery-beat
{%- if cookiecutter.use_docker == 'y' %}
-flower==2.0.0 # https://github.com/mher/flower
+flower==2.0.1 # https://github.com/mher/flower
{%- endif %}
{%- endif %}
{%- if cookiecutter.use_async == 'y' %}
-uvicorn[standard]==0.22.0 # https://github.com/encode/uvicorn
+uvicorn[standard]==0.23.2 # https://github.com/encode/uvicorn
{%- endif %}
# Django
# ------------------------------------------------------------------------------
-django==4.2.3 # pyup: < 5.0 # https://www.djangoproject.com/
+django==4.2.4 # pyup: < 5.0 # https://www.djangoproject.com/
django-environ==0.10.0 # https://github.com/joke2k/django-environ
django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils
-django-allauth==0.54.0 # https://github.com/pennersr/django-allauth
+django-allauth==0.55.0 # https://github.com/pennersr/django-allauth
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' %}
@@ -43,7 +43,7 @@ django-redis==5.3.0 # https://github.com/jazzband/django-redis
djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework
django-cors-headers==4.2.0 # https://github.com/adamchainz/django-cors-headers
# DRF-spectacular for api documentation
-drf-spectacular==0.26.3 # https://github.com/tfranzel/drf-spectacular
+drf-spectacular==0.26.4 # https://github.com/tfranzel/drf-spectacular
{%- endif %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
django-webpack-loader==2.0.1 # https://github.com/django-webpack/django-webpack-loader
diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt
index 1f7c1501f..20f6b41d1 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.3.6 # https://github.com/pallets/werkzeug
+Werkzeug[watchdog]==2.3.7 # https://github.com/pallets/werkzeug
ipdb==0.13.13 # https://github.com/gotcha/ipdb
{%- if cookiecutter.use_docker == 'y' %}
psycopg[c]==3.1.9 # https://github.com/psycopg/psycopg
@@ -8,17 +8,17 @@ psycopg[c]==3.1.9 # https://github.com/psycopg/psycopg
psycopg[binary]==3.1.9 # https://github.com/psycopg/psycopg
{%- endif %}
{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}
-watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles
+watchfiles==0.20.0 # https://github.com/samuelcolvin/watchfiles
{%- endif %}
# Testing
# ------------------------------------------------------------------------------
mypy==1.4.1 # https://github.com/python/mypy
-django-stubs==4.2.3 # https://github.com/typeddjango/django-stubs
+django-stubs[compatible-mypy]==4.2.3 # https://github.com/typeddjango/django-stubs
pytest==7.4.0 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.7 # https://github.com/Frozenball/pytest-sugar
{%- if cookiecutter.use_drf == "y" %}
-djangorestframework-stubs==3.14.2 # https://github.com/typeddjango/djangorestframework-stubs
+djangorestframework-stubs[compatible-mypy]==3.14.2 # https://github.com/typeddjango/djangorestframework-stubs
{%- endif %}
# Documentation
@@ -28,11 +28,11 @@ sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild
# Code quality
# ------------------------------------------------------------------------------
-flake8==6.0.0 # https://github.com/PyCQA/flake8
+flake8==6.1.0 # https://github.com/PyCQA/flake8
flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort
-coverage==7.2.7 # https://github.com/nedbat/coveragepy
+coverage==7.3.0 # https://github.com/nedbat/coveragepy
black==23.7.0 # https://github.com/psf/black
-djlint==1.31.1 # https://github.com/Riverside-Healthcare/djLint
+djlint==1.32.1 # https://github.com/Riverside-Healthcare/djLint
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
@@ -41,9 +41,9 @@ pre-commit==3.3.3 # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------
-factory-boy==3.2.1 # https://github.com/FactoryBoy/factory_boy
+factory-boy==3.3.0 # https://github.com/FactoryBoy/factory_boy
-django-debug-toolbar==4.1.0 # https://github.com/jazzband/django-debug-toolbar
+django-debug-toolbar==4.2.0 # https://github.com/jazzband/django-debug-toolbar
django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==3.1.0 # 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 537f081f5..da827e7e0 100644
--- a/{{cookiecutter.project_slug}}/requirements/production.txt
+++ b/{{cookiecutter.project_slug}}/requirements/production.txt
@@ -2,13 +2,13 @@
-r base.txt
-gunicorn==20.1.0 # https://github.com/benoitc/gunicorn
+gunicorn==21.2.0 # https://github.com/benoitc/gunicorn
psycopg[c]==3.1.9 # https://github.com/psycopg/psycopg
{%- if cookiecutter.use_whitenoise == 'n' %}
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
{%- endif %}
{%- if cookiecutter.use_sentry == "y" %}
-sentry-sdk==1.28.1 # https://github.com/getsentry/sentry-python
+sentry-sdk==1.29.2 # https://github.com/getsentry/sentry-python
{%- endif %}
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
hiredis==2.2.3 # https://github.com/redis/hiredis-py
@@ -24,21 +24,21 @@ django-storages[google]==1.13.2 # https://github.com/jschneier/django-storages
django-storages[azure]==1.13.2 # https://github.com/jschneier/django-storages
{%- endif %}
{%- if cookiecutter.mail_service == 'Mailgun' %}
-django-anymail[mailgun]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[mailgun]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Amazon SES' %}
-django-anymail[amazon-ses]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[amazon-ses]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Mailjet' %}
-django-anymail[mailjet]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[mailjet]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Mandrill' %}
-django-anymail[mandrill]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[mandrill]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Postmark' %}
-django-anymail[postmark]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[postmark]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Sendgrid' %}
-django-anymail[sendgrid]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[sendgrid]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'SendinBlue' %}
-django-anymail[sendinblue]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[sendinblue]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'SparkPost' %}
-django-anymail[sparkpost]==10.0 # https://github.com/anymail/django-anymail
+django-anymail[sparkpost]==10.1 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Other SMTP' %}
-django-anymail==10.0 # https://github.com/anymail/django-anymail
+django-anymail==10.1 # https://github.com/anymail/django-anymail
{%- endif %}
diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt
index 431fc7e8c..3124d55e9 100644
--- a/{{cookiecutter.project_slug}}/runtime.txt
+++ b/{{cookiecutter.project_slug}}/runtime.txt
@@ -1 +1 @@
-python-3.11.4
+python-3.11.5
diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg
index 829064213..2412f1746 100644
--- a/{{cookiecutter.project_slug}}/setup.cfg
+++ b/{{cookiecutter.project_slug}}/setup.cfg
@@ -4,6 +4,7 @@
[flake8]
max-line-length = 119
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv
+extend-ignore = E203
[pycodestyle]
max-line-length = 119
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py
index 080c734bb..e1822375b 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py
@@ -40,8 +40,8 @@ def update_site_forward(apps, schema_editor):
_update_or_create_site_with_sequence(
Site,
schema_editor.connection,
- "{{cookiecutter.domain_name}}",
- "{{cookiecutter.project_name}}",
+ "{{ cookiecutter.domain_name }}",
+ "{{ cookiecutter.project_name[:50] }}",
)
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403_csrf.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403_csrf.html
new file mode 100644
index 000000000..d90b33f9b
--- /dev/null
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403_csrf.html
@@ -0,0 +1,14 @@
+{% raw %}{% extends "base.html" %}
+
+{% block title %}Forbidden (403){% endblock title %}
+{% block content %}
+ Forbidden (403)
+
+ {% if exception %}
+ {{ exception }}
+ {% else %}
+ You're not allowed to access this page.
+ {% endif %}
+
+{% endblock content %}
+{%- endraw %}
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 4b86f7985..bebd8adcf 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py
@@ -29,6 +29,13 @@ class UserFactory(DjangoModelFactory):
)
self.set_password(password)
+ @classmethod
+ def _after_postgeneration(cls, instance, create, results=None):
+ """Save again the instance if creating and at least one hook ran."""
+ if create and results and not cls._meta.skip_postgeneration_save:
+ # Some post-generation hooks ran, and may have modified us.
+ instance.save()
+
class Meta:
model = get_user_model()
django_get_or_create = ["{{cookiecutter.username_type}}"]