Merge branch 'master' into migrate/unified-storages-setting

This commit is contained in:
Bruno Alla 2023-08-14 14:49:56 +01:00
commit 4735c7ebfb
No known key found for this signature in database
39 changed files with 445 additions and 131 deletions

View File

@ -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):

View File

@ -1418,5 +1418,40 @@
"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": ""
}
]

View File

@ -17,13 +17,13 @@ repos:
- id: detect-private-key
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0"
rev: "v3.0.1"
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

View File

@ -3,6 +3,120 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER -->
## 2023.08.10
### Fixed
- Corrected &#39;or&#39; 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
### Updated
- Update sentry-sdk to 1.28.1 ([#4458](https://github.com/cookiecutter/cookiecutter-django/pull/4458))
## 2023.07.11

View File

@ -796,6 +796,13 @@ Listed in alphabetical order.
</td>
<td>fabaff</td>
</tr>
<tr>
<td>Fateme Fouladkar</td>
<td>
<a href="https://github.com/FatemeFouladkar">FatemeFouladkar</a>
</td>
<td></td>
</tr>
<tr>
<td>Felipe Arruda</td>
<td>
@ -936,6 +943,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>hleroy</td>
<td>
<a href="https://github.com/hleroy">hleroy</a>
</td>
<td></td>
</tr>
<tr>
<td>Hoai-Thu Vuong</td>
<td>
@ -957,6 +971,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>Imran Rahman</td>
<td>
<a href="https://github.com/infraredCoding">infraredCoding</a>
</td>
<td></td>
</tr>
<tr>
<td>innicoder</td>
<td>
@ -1685,6 +1706,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>Sadra Yahyapour</td>
<td>
<a href="https://github.com/lnxpy">lnxpy</a>
</td>
<td>lnxpylnxpy</td>
</tr>
<tr>
<td>Sam Collins</td>
<td>
@ -1706,6 +1734,13 @@ Listed in alphabetical order.
</td>
<td>sebastianreyese</td>
</tr>
<tr>
<td>Shayan Karimi</td>
<td>
<a href="https://github.com/shywn-mrk">shywn-mrk</a>
</td>
<td>shywn_mrk</td>
</tr>
<tr>
<td>Simon Rey</td>
<td>
@ -1790,6 +1825,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>Tharushan</td>
<td>
<a href="https://github.com/Tharushan">Tharushan</a>
</td>
<td></td>
</tr>
<tr>
<td>Thibault J.</td>
<td>
@ -2000,6 +2042,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>zhaoruibing</td>
<td>
<a href="https://github.com/zhaoruibing">zhaoruibing</a>
</td>
<td></td>
</tr>
</table>
### Special Thanks

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -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`
},

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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::

View File

@ -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!).

View File

@ -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()

View File

@ -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
flake8==6.1.0
django-upgrade==1.14.0
djlint==1.31.1
djlint==1.32.1
pre-commit==3.3.3
# Testing
# ------------------------------------------------------------------------------
tox==4.6.4
tox==4.8.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

View File

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

View File

@ -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):

View File

@ -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

View File

@ -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 containers default command
"overrideCommand": true,
"overrideCommand": false,
"service": "django",
// "remoteEnv": {"PATH": "/home/dev-user/.local/bin:${containerEnv:PATH}"},
"remoteUser": "dev-user",

View File

@ -9,3 +9,4 @@
.travis.yml
venv
.git
.envs/

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -16,15 +16,13 @@ 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.1
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'
@ -33,13 +31,13 @@ repos:
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@
### Create a database backup.
###
### Usage:
### $ docker-compose -f <environment>.yml (exec |run --rm) postgres backup
### $ docker compose -f <environment>.yml (exec |run --rm) postgres backup
set -o errexit

View File

@ -4,7 +4,7 @@
### View backups.
###
### Usage:
### $ docker-compose -f <environment>.yml (exec |run --rm) postgres backups
### $ docker compose -f <environment>.yml (exec |run --rm) postgres backups
set -o errexit

View File

@ -7,7 +7,7 @@
### <1> filename of an existing backup.
###
### Usage:
### $ docker-compose -f <environment>.yml (exec |run --rm) postgres restore <1>
### $ docker compose -f <environment>.yml (exec |run --rm) postgres restore <1>
set -o errexit

View File

@ -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

View File

@ -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 -%}

View File

@ -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 `<locale name>/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.

View File

@ -127,7 +127,7 @@ msgstr "Ou, <a href=\"%(signup_url)s\">cadastre-se</a> 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

View File

@ -19,16 +19,16 @@ 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
@ -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

View File

@ -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
@ -14,11 +14,11 @@ watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles
# 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

View File

@ -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 %}

View File

@ -0,0 +1,14 @@
{% raw %}{% extends "base.html" %}
{% block title %}Forbidden (403){% endblock title %}
{% block content %}
<h1>Forbidden (403)</h1>
<p>
{% if exception %}
{{ exception }}
{% else %}
You're not allowed to access this page.
{% endif %}
</p>
{% endblock content %}
{%- endraw %}