diff --git a/.github/contributors.json b/.github/contributors.json index 49ebfe4d8..34c84979d 100644 --- a/.github/contributors.json +++ b/.github/contributors.json @@ -1322,5 +1322,30 @@ "name": "rguptar", "github_login": "rguptar", "twitter_username": "" + }, + { + "name": "Omer-5", + "github_login": "Omer-5", + "twitter_username": "" + }, + { + "name": "TAKAHASHI Shuuji", + "github_login": "shuuji3", + "twitter_username": "" + }, + { + "name": "Thomas Booij", + "github_login": "ThomasBooij95", + "twitter_username": "" + }, + { + "name": "Pamela Fox", + "github_login": "pamelafox", + "twitter_username": "pamelafox" + }, + { + "name": "Robin", + "github_login": "Kaffeetasse", + "twitter_username": "" } ] \ No newline at end of file diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml index 952486c1b..83c651a46 100644 --- a/.github/workflows/update-contributors.yml +++ b/.github/workflows/update-contributors.yml @@ -29,6 +29,8 @@ jobs: pip install -r requirements.txt - name: Update list run: python scripts/update_contributors.py + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4.16.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e8d055772..ca86e7eb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,19 +9,19 @@ repos: - id: check-yaml - repo: https://github.com/asottile/pyupgrade - rev: v3.3.0 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py310-plus] exclude: hooks/ - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort diff --git a/CHANGELOG.md b/CHANGELOG.md index b0e1e6690..344978d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,165 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2023.01.17 + +### Updated +- Update tox to 4.3.3 ([#4081](https://github.com/cookiecutter/cookiecutter-django/pull/4081)) + +## 2023.01.15 + +### Updated +- Update pytest to 7.2.1 ([#4077](https://github.com/cookiecutter/cookiecutter-django/pull/4077)) +- Update pytz to 2022.7.1 ([#4078](https://github.com/cookiecutter/cookiecutter-django/pull/4078)) + +## 2023.01.12 + +### Updated +- Update sentry-sdk to 1.13.0 ([#4074](https://github.com/cookiecutter/cookiecutter-django/pull/4074)) + +## 2023.01.11 + +### Changed +- Update Celery instructions in the documentation ([#4061](https://github.com/cookiecutter/cookiecutter-django/pull/4061)) +### Updated +- Update tox to 4.2.7 ([#4073](https://github.com/cookiecutter/cookiecutter-django/pull/4073)) + +## 2023.01.10 + +### Changed +- Add dump.rdb to gitignore ([#4062](https://github.com/cookiecutter/cookiecutter-django/pull/4062)) +### Fixed +- Exclude `.venv` from code style checks ([#4069](https://github.com/cookiecutter/cookiecutter-django/pull/4069)) +### Updated +- Update hiredis to 2.1.1 ([#4070](https://github.com/cookiecutter/cookiecutter-django/pull/4070)) + +## 2023.01.08 + +### Updated +- Update redis to 4.4.1 ([#4068](https://github.com/cookiecutter/cookiecutter-django/pull/4068)) +- Update coverage to 7.0.4 ([#4067](https://github.com/cookiecutter/cookiecutter-django/pull/4067)) + +## 2023.01.07 + +### Updated +- Update tox to 4.2.6 ([#4064](https://github.com/cookiecutter/cookiecutter-django/pull/4064)) +- Update django-storages to 1.13.2 ([#4057](https://github.com/cookiecutter/cookiecutter-django/pull/4057)) +- Update isort to 5.11.4 ([#4058](https://github.com/cookiecutter/cookiecutter-django/pull/4058)) +- Update rcssmin to 1.1.1 ([#4060](https://github.com/cookiecutter/cookiecutter-django/pull/4060)) +- Update django-compressor to 4.3 ([#4063](https://github.com/cookiecutter/cookiecutter-django/pull/4063)) + +## 2023.01.06 + +### Changed +- Add `.git` to `.dockerignore` ([#4054](https://github.com/cookiecutter/cookiecutter-django/pull/4054)) +- Fix link and add non-Docker commands to testing page in the docs ([#4036](https://github.com/cookiecutter/cookiecutter-django/pull/4036)) +### Updated +- Update tox to 4.2.3 ([#4051](https://github.com/cookiecutter/cookiecutter-django/pull/4051)) + +## 2023.01.04 + +### Changed +- Fix typo on test settings ([#4049](https://github.com/cookiecutter/cookiecutter-django/pull/4049)) +### Updated +- Update tox to 4.2.2 ([#4050](https://github.com/cookiecutter/cookiecutter-django/pull/4050)) +- Update tox to 4.2.1 ([#4046](https://github.com/cookiecutter/cookiecutter-django/pull/4046)) +- Update coverage to 7.0.3 ([#4047](https://github.com/cookiecutter/cookiecutter-django/pull/4047)) + +## 2023.01.03 + +### Updated +- Update flake8-isort to 6.0.0 ([#4022](https://github.com/cookiecutter/cookiecutter-django/pull/4022)) +- Update tox to 4.1.3 ([#4041](https://github.com/cookiecutter/cookiecutter-django/pull/4041)) +- Update pillow to 9.4.0 ([#4040](https://github.com/cookiecutter/cookiecutter-django/pull/4040)) +- Update gitpython to 3.1.30 ([#4032](https://github.com/cookiecutter/cookiecutter-django/pull/4032)) +- Update coverage to 7.0.2 ([#4042](https://github.com/cookiecutter/cookiecutter-django/pull/4042)) +- Update whitenoise to 6.3.0 ([#4044](https://github.com/cookiecutter/cookiecutter-django/pull/4044)) + +## 2022.12.29 + +### Updated +- Update tox to 4.1.0 ([#4035](https://github.com/cookiecutter/cookiecutter-django/pull/4035)) +- Update tox to 4.0.19 ([#4030](https://github.com/cookiecutter/cookiecutter-django/pull/4030)) +- Update django-allauth to 0.52.0 ([#4033](https://github.com/cookiecutter/cookiecutter-django/pull/4033)) + +## 2022.12.26 + +### Updated +- Update tox to 4.0.17 ([#4027](https://github.com/cookiecutter/cookiecutter-django/pull/4027)) +- Update pre-commit to 2.21.0 ([#4026](https://github.com/cookiecutter/cookiecutter-django/pull/4026)) + +## 2022.12.25 + +### Updated +- Auto-update pre-commit hooks ([#4021](https://github.com/cookiecutter/cookiecutter-django/pull/4021)) + +## 2022.12.24 + +### Updated +- Update coverage to 7.0.1 ([#4024](https://github.com/cookiecutter/cookiecutter-django/pull/4024)) + +## 2022.12.21 + +### Changed +- Retry when trying to store a Celery result in backend ([#3996](https://github.com/cookiecutter/cookiecutter-django/pull/3996)) +- Update image URL for build status shield badge ([#4018](https://github.com/cookiecutter/cookiecutter-django/pull/4018)) +### Updated +- Update pytz to 2022.7 ([#4020](https://github.com/cookiecutter/cookiecutter-django/pull/4020)) +- Update ipdb to 0.13.11 ([#4019](https://github.com/cookiecutter/cookiecutter-django/pull/4019)) +- Update tox to 4.0.16 ([#4017](https://github.com/cookiecutter/cookiecutter-django/pull/4017)) +- Update sentry-sdk to 1.12.1 ([#4014](https://github.com/cookiecutter/cookiecutter-django/pull/4014)) +- Update coverage to 7.0.0 ([#4013](https://github.com/cookiecutter/cookiecutter-django/pull/4013)) +- Update django-anymail to 9.0 ([#4012](https://github.com/cookiecutter/cookiecutter-django/pull/4012)) +- Auto-update pre-commit hooks ([#4005](https://github.com/cookiecutter/cookiecutter-django/pull/4005)) +- Update isort to 5.11.3 ([#4010](https://github.com/cookiecutter/cookiecutter-django/pull/4010)) +- Update drf-spectacular to 0.25.1 ([#4009](https://github.com/cookiecutter/cookiecutter-django/pull/4009)) +- Update hiredis to 2.1.0 ([#4006](https://github.com/cookiecutter/cookiecutter-django/pull/4006)) + +## 2022.12.13 + +### Changed +- Improve documentation for Getting started with Docker ([#4003](https://github.com/cookiecutter/cookiecutter-django/pull/4003)) +### Updated +- Update isort to 5.11.1 ([#3999](https://github.com/cookiecutter/cookiecutter-django/pull/3999)) +- Auto-update pre-commit hooks ([#3998](https://github.com/cookiecutter/cookiecutter-django/pull/3998)) +- Update isort to 5.11.0 ([#3997](https://github.com/cookiecutter/cookiecutter-django/pull/3997)) + +## 2022.12.10 + +### Updated +- Update tox to 4.0.5 ([#3993](https://github.com/cookiecutter/cookiecutter-django/pull/3993)) +- Auto-update pre-commit hooks ([#3991](https://github.com/cookiecutter/cookiecutter-django/pull/3991)) + +## 2022.12.09 + +### Changed +- Remove bind option mounts for docker compose volumes ([#3981](https://github.com/cookiecutter/cookiecutter-django/pull/3981)) +### Updated +- Update djangorestframework-stubs to 1.8.0 ([#3990](https://github.com/cookiecutter/cookiecutter-django/pull/3990)) +- Update black to 22.12.0 ([#3988](https://github.com/cookiecutter/cookiecutter-django/pull/3988)) + +## 2022.12.08 + +### Updated +- Update tox to 4.0.3 ([#3987](https://github.com/cookiecutter/cookiecutter-django/pull/3987)) +- Update tox to 4.0.2 ([#3985](https://github.com/cookiecutter/cookiecutter-django/pull/3985)) +- Update django-stubs to 1.13.1 ([#3986](https://github.com/cookiecutter/cookiecutter-django/pull/3986)) + +## 2022.12.07 + +### Updated +- Auto-update pre-commit hooks ([#3983](https://github.com/cookiecutter/cookiecutter-django/pull/3983)) + +## 2022.12.06 + +### Changed +- Simplify production `DATABASES` setting to extend base definition ([#3969](https://github.com/cookiecutter/cookiecutter-django/pull/3969)) +### Fixed +- Only set `SERVERS` for `drf-spectacular` in production ([#3609](https://github.com/cookiecutter/cookiecutter-django/pull/3609)) +### Updated +- Update django-coverage-plugin to 3.0.0 ([#3979](https://github.com/cookiecutter/cookiecutter-django/pull/3979)) +- Bump stefanzweifel/git-auto-commit-action from 4.15.4 to 4.16.0 ([#3978](https://github.com/cookiecutter/cookiecutter-django/pull/3978)) + ## 2022.12.04 ### Updated diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d97324708..718d58c57 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1447,6 +1447,13 @@ Listed in alphabetical order. + + Omer-5 + + Omer-5 + + + Pablo @@ -1454,6 +1461,13 @@ Listed in alphabetical order. + + Pamela Fox + + pamelafox + + pamelafox + Parbhat Puri @@ -1559,6 +1573,13 @@ Listed in alphabetical order. + + Robin + + Kaffeetasse + + + Roman Afanaskin @@ -1664,6 +1685,13 @@ Listed in alphabetical order. + + TAKAHASHI Shuuji + + shuuji3 + + + Tames McTigue @@ -1692,6 +1720,13 @@ Listed in alphabetical order. thibault + + Thomas Booij + + ThomasBooij95 + + + Théo Segonds diff --git a/README.md b/README.md index 7fa46a777..0697862c5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cookiecutter Django -[![Build Status](https://img.shields.io/github/workflow/status/cookiecutter/cookiecutter-django/CI/master)](https://github.com/cookiecutter/cookiecutter-django/actions?query=workflow%3ACI) +[![Build Status](https://img.shields.io/github/actions/workflow/status/cookiecutter/cookiecutter-django/ci.yml?branch=master)](https://github.com/cookiecutter/cookiecutter-django/actions/workflows/ci.yml?query=branch%3Amaster) [![Documentation Status](https://readthedocs.org/projects/cookiecutter-django/badge/?version=latest)](https://cookiecutter-django.readthedocs.io/en/latest/?badge=latest) [![Updates](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/shield.svg)](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/) [![Join our Discord](https://img.shields.io/badge/Discord-cookiecutter-5865F2?style=flat&logo=discord&logoColor=white)](https://discord.gg/uFXweDQc5a) diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index 4bb5d9032..a7d77e108 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -3,9 +3,6 @@ Getting Up and Running Locally With Docker .. index:: Docker -The steps below will get you up and running with a local development environment. -All of these commands assume you are in the root of your generated project. - .. note:: If you're new to Docker, please be aware that some resources are cached system-wide @@ -19,10 +16,16 @@ Prerequisites * Docker; if you don't have it yet, follow the `installation instructions`_; * Docker Compose; refer to the official documentation for the `installation guide`_. * Pre-commit; refer to the official documentation for the `pre-commit`_. +* Cookiecutter; refer to the official GitHub repository of `Cookiecutter`_ .. _`installation instructions`: https://docs.docker.com/install/#supported-platforms .. _`installation guide`: https://docs.docker.com/compose/install/ .. _`pre-commit`: https://pre-commit.com/#install +.. _`Cookiecutter`: https://github.com/cookiecutter/cookiecutter + +Before Getting Started +---------------------- +.. include:: generate-project-block.rst Build the Stack --------------- diff --git a/docs/developing-locally.rst b/docs/developing-locally.rst index 4bf49488d..fb66536fc 100644 --- a/docs/developing-locally.rst +++ b/docs/developing-locally.rst @@ -24,9 +24,8 @@ First things first. $ source /bin/activate -#. Install cookiecutter-django: :: - - $ cookiecutter gh:cookiecutter/cookiecutter-django +#. + .. include:: generate-project-block.rst #. Install development requirements: :: @@ -43,6 +42,7 @@ First things first. #. Create a new PostgreSQL database using createdb_: :: $ createdb --username=postgres + ``project_slug`` is what you have entered as the project_slug at the setup stage. .. note:: @@ -141,15 +141,32 @@ In production, we have Mailgun_ configured to have your back! Celery ------ -If the project is configured to use Celery as a task scheduler then by default tasks are set to run on the main thread -when developing locally. If you have the appropriate setup on your local machine then set the following -in ``config/settings/local.py``:: +If the project is configured to use Celery as a task scheduler then, by default, tasks are set to run on the main thread when developing locally instead of getting sent to a broker. However, if you have Redis setup on your local machine, you can set the following in ``config/settings/local.py``:: CELERY_TASK_ALWAYS_EAGER = False -To run Celery locally, make sure redis-server is installed (instructions are available at https://redis.io/topics/quickstart), run the server in one terminal with `redis-server`, and then start celery in another terminal with the following command:: +Next, make sure `redis-server` is installed (per the `Getting started with Redis`_ guide) and run the server in one terminal:: - celery -A config.celery_app worker --loglevel=info + $ redis-server + +Start the Celery worker by running the following command in another terminal:: + + $ celery -A config.celery_app worker --loglevel=info + +That Celery worker should be running whenever your app is running, typically as a background process, +so that it can pick up any tasks that get queued. Learn more from the `Celery Workers Guide`_. + +The project comes with a simple task for manual testing purposes, inside `/users/tasks.py`. To queue that task locally, start the Django shell, import the task, and call `delay()` on it:: + + $ python manage.py shell + >> from .users.tasks import get_users_count + >> get_users_count.delay() + +You can also use Django admin to queue up tasks, thanks to the `django-celerybeat`_ package. + +.. _Getting started with Redis guide: https://redis.io/docs/getting-started/ +.. _Celery Workers Guide: https://docs.celeryq.dev/en/stable/userguide/workers.html +.. _django-celerybeat: https://django-celery-beat.readthedocs.io/en/latest/ Sass Compilation & Live Reloading diff --git a/docs/generate-project-block.rst b/docs/generate-project-block.rst new file mode 100644 index 000000000..2842b551d --- /dev/null +++ b/docs/generate-project-block.rst @@ -0,0 +1,7 @@ +Generate a new cookiecutter-django project: :: + + $ cookiecutter gh:cookiecutter/cookiecutter-django + +For more information refer to +:ref:`Project Generation Options `. + diff --git a/docs/testing.rst b/docs/testing.rst index dd6fcb48f..bea45c6dd 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -28,10 +28,15 @@ Coverage You should build your tests to provide the highest level of **code coverage**. You can run the ``pytest`` with code ``coverage`` by typing in the following command: :: - $ docker-compose -f local.yml run --rm django coverage run -m pytest + $ coverage run -m pytest Once the tests are complete, in order to see the code coverage, run the following command: :: + $ coverage report + +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 .. note:: @@ -53,4 +58,4 @@ Once the tests are complete, in order to see the code coverage, run the followin .. _develop locally with docker: ./developing-locally-docker.html .. _customize: https://docs.pytest.org/en/latest/customize.html .. _unittest: https://docs.python.org/3/library/unittest.html#module-unittest -.. _configuring: https://coverage.readthedocs.io/en/v4.5.x/config.html +.. _configuring: https://coverage.readthedocs.io/en/latest/config.html diff --git a/requirements.txt b/requirements.txt index 684ec91e0..5dc9d97ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,16 +4,16 @@ binaryornot==0.4.4 # Code quality # ------------------------------------------------------------------------------ -black==22.10.0 -isort==5.10.1 +black==22.12.0 +isort==5.11.4 flake8==6.0.0 -flake8-isort==5.0.3 -pre-commit==2.20.0 +flake8-isort==6.0.0 +pre-commit==2.21.0 # Testing # ------------------------------------------------------------------------------ -tox==3.27.1 -pytest==7.2.0 +tox==4.3.3 +pytest==7.2.1 pytest-cookies==0.6.1 pytest-instafail==0.4.2 pyyaml==6.0 @@ -21,6 +21,6 @@ pyyaml==6.0 # Scripting # ------------------------------------------------------------------------------ PyGithub==1.57 -gitpython==3.1.29 +gitpython==3.1.30 jinja2==3.1.2 requests==2.28.1 diff --git a/setup.py b/setup.py index e187601c3..1b0f44843 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: from distutils.core import setup # We use calendar versioning -version = "2022.12.04" +version = "2023.01.17" with open("README.rst") as readme_file: long_description = readme_file.read() diff --git a/{{cookiecutter.project_slug}}/.dockerignore b/{{cookiecutter.project_slug}}/.dockerignore index 5518e60af..7369480e3 100644 --- a/{{cookiecutter.project_slug}}/.dockerignore +++ b/{{cookiecutter.project_slug}}/.dockerignore @@ -8,3 +8,4 @@ .readthedocs.yml .travis.yml venv +.git diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 6fb8cf6d8..19bb2bc07 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -326,6 +326,9 @@ Session.vim # Auto-generated tag files tags +# Redis dump file +dump.rdb + ### Project template {%- if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %} MailHog @@ -343,6 +346,7 @@ project.css project.min.css vendors.js *.min.js +*.min.js.map {%- endif %} {%- if cookiecutter.frontend_pipeline == 'Webpack' %} {{ cookiecutter.project_slug }}/static/webpack_bundles/ diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 516323b42..c1aaf0d9f 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -10,18 +10,18 @@ repos: - id: check-yaml - repo: https://github.com/asottile/pyupgrade - rev: v3.3.0 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py310-plus] - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 26aa5f76a..dbf18d655 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -286,6 +286,11 @@ CELERY_BROKER_URL = env("CELERY_BROKER_URL") CELERY_RESULT_BACKEND = CELERY_BROKER_URL # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended CELERY_RESULT_EXTENDED = True +# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry +# https://github.com/celery/celery/pull/6122 +CELERY_RESULT_BACKEND_ALWAYS_RETRY = True +# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-max-retries +CELERY_RESULT_BACKEND_MAX_RETRIES = 10 # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-accept_content CELERY_ACCEPT_CONTENT = ["json"] # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-task_serializer @@ -353,10 +358,6 @@ SPECTACULAR_SETTINGS = { "DESCRIPTION": "Documentation of API endpoints of {{ cookiecutter.project_name }}", "VERSION": "1.0.0", "SERVE_PERMISSIONS": ["rest_framework.permissions.IsAdminUser"], - "SERVERS": [ - {"url": "http://127.0.0.1:8000", "description": "Local Development server"}, - {"url": "https://{{ cookiecutter.domain_name }}", "description": "Production server"}, - ], } {%- endif %} {%- if cookiecutter.frontend_pipeline == 'Webpack' %} diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 40d3f19cc..5de0529e2 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -22,8 +22,6 @@ ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["{{ cookiecutter.domai # DATABASES # ------------------------------------------------------------------------------ -DATABASES["default"] = env.db("DATABASE_URL") # noqa F405 -DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa F405 DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) # noqa F405 # CACHES @@ -370,5 +368,15 @@ sentry_sdk.init( traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE", default=0.0), ) {% endif %} +{% if cookiecutter.use_drf == "y" -%} + +# django-rest-framework +# ------------------------------------------------------------------------------- +# Tools that generate code samples can use SERVERS to point to the correct domain +SPECTACULAR_SETTINGS["SERVERS"] = [ # noqa F405 + {"url": "https://{{ cookiecutter.domain_name }}", "description": "Production server"} +] + +{%- endif %} # Your stuff... # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index f103eb10b..198b5aa5d 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -25,7 +25,7 @@ PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] # https://docs.djangoproject.com/en/dev/ref/settings/#email-backend EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" -# DEBUGING FOR TEMPLATES +# DEBUGGING FOR TEMPLATES # ------------------------------------------------------------------------------ TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405 diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index afc2b0abd..fa3636eab 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -85,13 +85,13 @@ function scripts() { // Vendor Javascript minification function vendorScripts() { - return src(paths.vendorsJs) + return src(paths.vendorsJs, { sourcemaps: true }) .pipe(concat('vendors.js')) .pipe(dest(paths.js)) .pipe(plumber()) // Checks for errors .pipe(uglify()) // Minifies the js .pipe(rename({ suffix: '.min' })) - .pipe(dest(paths.js)) + .pipe(dest(paths.js, { sourcemaps: '.' })) } // Image compression diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index 798fa0897..66ca3b0ef 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -35,8 +35,8 @@ services: image: {{ cookiecutter.project_slug }}_production_postgres container_name: {{ cookiecutter.project_slug }}_local_postgres volumes: - - {{ cookiecutter.project_slug }}_local_postgres_data:/var/lib/postgresql/data:Z - - {{ cookiecutter.project_slug }}_local_postgres_data_backups:/backups:z + - {{ cookiecutter.project_slug }}_local_postgres_data:/var/lib/postgresql/data + - {{ cookiecutter.project_slug }}_local_postgres_data_backups:/backups env_file: - ./.envs/.local/.postgres diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index 95927018d..45c8b3c1d 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -38,8 +38,8 @@ services: dockerfile: ./compose/production/postgres/Dockerfile image: {{ cookiecutter.project_slug }}_production_postgres volumes: - - production_postgres_data:/var/lib/postgresql/data:Z - - production_postgres_data_backups:/backups:z + - production_postgres_data:/var/lib/postgresql/data + - production_postgres_data_backups:/backups env_file: - ./.envs/.production/.postgres @@ -51,7 +51,7 @@ services: depends_on: - django volumes: - - production_traefik:/etc/traefik/acme:z + - production_traefik:/etc/traefik/acme ports: - "0.0.0.0:80:80" - "0.0.0.0:443:443" diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 35f8ee11c..853da59a7 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,20 +1,20 @@ -pytz==2022.6 # https://github.com/stub42/pytz +pytz==2022.7.1 # https://github.com/stub42/pytz python-slugify==7.0.0 # https://github.com/un33k/python-slugify -Pillow==9.3.0 # https://github.com/python-pillow/Pillow +Pillow==9.4.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin {%- else %} -rcssmin==1.1.0 # https://github.com/ndparker/rcssmin +rcssmin==1.1.1 # https://github.com/ndparker/rcssmin {%- endif %} {%- endif %} argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} -whitenoise==6.2.0 # https://github.com/evansd/whitenoise +whitenoise==6.3.0 # https://github.com/evansd/whitenoise {%- endif %} -redis==4.4.0 # https://github.com/redis/redis-py +redis==4.4.1 # https://github.com/redis/redis-py {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} -hiredis==2.0.0 # https://github.com/redis/hiredis-py +hiredis==2.1.1 # https://github.com/redis/hiredis-py {%- endif %} {%- if cookiecutter.use_celery == "y" %} celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery @@ -32,11 +32,11 @@ uvicorn[standard]==0.20.0 # https://github.com/encode/uvicorn django==4.0.8 # pyup: < 4.1 # https://www.djangoproject.com/ django-environ==0.9.0 # https://github.com/joke2k/django-environ django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils -django-allauth==0.51.0 # https://github.com/pennersr/django-allauth +django-allauth==0.52.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5 {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} -django-compressor==4.1 # https://github.com/django-compressor/django-compressor +django-compressor==4.3 # https://github.com/django-compressor/django-compressor {%- endif %} django-redis==5.2.0 # https://github.com/jazzband/django-redis {%- if cookiecutter.use_drf == 'y' %} @@ -44,7 +44,7 @@ django-redis==5.2.0 # https://github.com/jazzband/django-redis djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers # DRF-spectacular for api documentation -drf-spectacular==0.24.2 # https://github.com/tfranzel/drf-spectacular +drf-spectacular==0.25.1 # https://github.com/tfranzel/drf-spectacular {%- endif %} {%- if cookiecutter.frontend_pipeline == 'Webpack' %} django-webpack-loader==1.7.0 # 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 6082a72c8..89abc0a0e 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,7 +1,7 @@ -r base.txt Werkzeug[watchdog]==2.2.2 # https://github.com/pallets/werkzeug -ipdb==0.13.9 # https://github.com/gotcha/ipdb +ipdb==0.13.11 # https://github.com/gotcha/ipdb {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.9.5 # https://github.com/psycopg/psycopg2 {%- else %} @@ -14,11 +14,11 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles # Testing # ------------------------------------------------------------------------------ mypy==0.982 # https://github.com/python/mypy -django-stubs==1.12.0 # https://github.com/typeddjango/django-stubs -pytest==7.2.0 # https://github.com/pytest-dev/pytest +django-stubs==1.13.1 # https://github.com/typeddjango/django-stubs +pytest==7.2.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} -djangorestframework-stubs==1.7.0 # https://github.com/typeddjango/djangorestframework-stubs +djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs {%- endif %} # Documentation @@ -29,14 +29,14 @@ sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild # Code quality # ------------------------------------------------------------------------------ flake8==6.0.0 # https://github.com/PyCQA/flake8 -flake8-isort==5.0.3 # https://github.com/gforcada/flake8-isort -coverage==6.5.0 # https://github.com/nedbat/coveragepy -black==22.10.0 # https://github.com/psf/black +flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort +coverage==7.0.4 # https://github.com/nedbat/coveragepy +black==22.12.0 # https://github.com/psf/black pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery {%- endif %} -pre-commit==2.20.0 # https://github.com/pre-commit/pre-commit +pre-commit==2.21.0 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index c9b5b88a7..fd449d1fe 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,37 +8,37 @@ psycopg2==2.9.5 # https://github.com/psycopg/psycopg2 Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==1.11.1 # https://github.com/getsentry/sentry-python +sentry-sdk==1.13.0 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} -hiredis==2.0.0 # https://github.com/redis/hiredis-py +hiredis==2.1.1 # https://github.com/redis/hiredis-py {%- endif %} # Django # ------------------------------------------------------------------------------ {%- if cookiecutter.cloud_provider == 'AWS' %} -django-storages[boto3]==1.13.1 # https://github.com/jschneier/django-storages +django-storages[boto3]==1.13.2 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'GCP' %} -django-storages[google]==1.13.1 # https://github.com/jschneier/django-storages +django-storages[google]==1.13.2 # https://github.com/jschneier/django-storages {%- elif cookiecutter.cloud_provider == 'Azure' %} -django-storages[azure]==1.13.1 # 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]==8.6 # https://github.com/anymail/django-anymail +django-anymail[mailgun]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Amazon SES' %} -django-anymail[amazon_ses]==8.6 # https://github.com/anymail/django-anymail +django-anymail[amazon_ses]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Mailjet' %} -django-anymail[mailjet]==8.6 # https://github.com/anymail/django-anymail +django-anymail[mailjet]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Mandrill' %} -django-anymail[mandrill]==8.6 # https://github.com/anymail/django-anymail +django-anymail[mandrill]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Postmark' %} -django-anymail[postmark]==8.6 # https://github.com/anymail/django-anymail +django-anymail[postmark]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Sendgrid' %} -django-anymail[sendgrid]==8.6 # https://github.com/anymail/django-anymail +django-anymail[sendgrid]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'SendinBlue' %} -django-anymail[sendinblue]==8.6 # https://github.com/anymail/django-anymail +django-anymail[sendinblue]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'SparkPost' %} -django-anymail[sparkpost]==8.6 # https://github.com/anymail/django-anymail +django-anymail[sparkpost]==9.0 # https://github.com/anymail/django-anymail {%- elif cookiecutter.mail_service == 'Other SMTP' %} -django-anymail==8.6 # https://github.com/anymail/django-anymail +django-anymail==9.0 # https://github.com/anymail/django-anymail {%- endif %} diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index 3bec1fbee..7ee60215a 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -1,10 +1,10 @@ [flake8] max-line-length = 120 -exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv +exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv [pycodestyle] max-line-length = 120 -exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv +exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv [isort] line_length = 88 @@ -34,7 +34,7 @@ django_settings_module = config.settings.test ignore_errors = True [coverage:run] -include = {{cookiecutter.project_slug}}/* +include = {{cookiecutter.project_slug}}/** omit = *migrations*, *tests* plugins = django_coverage_plugin