mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 09:24:52 +03:00
Merge branch 'master' into master
This commit is contained in:
commit
9efed2ee70
15
.github/contributors.json
vendored
15
.github/contributors.json
vendored
|
@ -1357,5 +1357,20 @@
|
||||||
"name": "tildebox",
|
"name": "tildebox",
|
||||||
"github_login": "tildebox",
|
"github_login": "tildebox",
|
||||||
"twitter_username": ""
|
"twitter_username": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "duffn",
|
||||||
|
"github_login": "duffn",
|
||||||
|
"twitter_username": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Delphine LEMIRE",
|
||||||
|
"github_login": "DelphineLemire",
|
||||||
|
"twitter_username": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Hoai-Thu Vuong",
|
||||||
|
"github_login": "thuvh",
|
||||||
|
"twitter_username": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
53
.github/dependabot.yml
vendored
53
.github/dependabot.yml
vendored
|
@ -18,3 +18,56 @@ updates:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
labels:
|
labels:
|
||||||
- "update"
|
- "update"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
# We need to specify each Dockerfile in a separate entry because Dependabot doesn't
|
||||||
|
# support wildcards or recursively checking subdirectories. Check this issue for updates:
|
||||||
|
# https://github.com/dependabot/dependabot-core/issues/2178
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/local/django/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/local/docs/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/local/node/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/production/aws/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/production/django/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/production/postgres/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "{{cookiecutter.project_slug}}/compose/production/traefik/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "update"
|
||||||
|
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -2,6 +2,7 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches: [ "master", "main" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
@ -9,17 +10,6 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
cache: pip
|
|
||||||
- name: Run pre-commit
|
|
||||||
uses: pre-commit/action@v3.0.0
|
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
|
@ -16,7 +16,7 @@ repos:
|
||||||
exclude: hooks/
|
exclude: hooks/
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.12.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
||||||
|
|
67
CHANGELOG.md
67
CHANGELOG.md
|
@ -3,6 +3,73 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
|
||||||
|
|
||||||
<!-- GENERATOR_PLACEHOLDER -->
|
<!-- GENERATOR_PLACEHOLDER -->
|
||||||
|
|
||||||
|
## 2023.02.17
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Update version of github actions on the template project ([#4167](https://github.com/cookiecutter/cookiecutter-django/pull/4167))
|
||||||
|
|
||||||
|
## 2023.02.09
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Remove unused pip cache paths in GHA & add a note for pre-commit.ci ([#4151](https://github.com/cookiecutter/cookiecutter-django/pull/4151))
|
||||||
|
### Updated
|
||||||
|
- Update mypy to 0.991 ([#4106](https://github.com/cookiecutter/cookiecutter-django/pull/4106))
|
||||||
|
|
||||||
|
## 2023.02.08
|
||||||
|
|
||||||
|
### Updated
|
||||||
|
- Update sphinx to 6.1.3 ([#4148](https://github.com/cookiecutter/cookiecutter-django/pull/4148))
|
||||||
|
- Update redis to 4.5.1 ([#4147](https://github.com/cookiecutter/cookiecutter-django/pull/4147))
|
||||||
|
|
||||||
|
## 2023.02.07
|
||||||
|
|
||||||
|
### Updated
|
||||||
|
- Bump postcss-preset-env from 7.8.3 to 8.0.1 ([#4115](https://github.com/cookiecutter/cookiecutter-django/pull/4115))
|
||||||
|
- Bump sass-loader from 12.6.0 to 13.2.0 ([#4116](https://github.com/cookiecutter/cookiecutter-django/pull/4116))
|
||||||
|
- Bump babel-loader from 8.3.0 to 9.1.2 ([#4117](https://github.com/cookiecutter/cookiecutter-django/pull/4117))
|
||||||
|
- Bump postcss-loader from 6.2.1 to 7.0.2 ([#4114](https://github.com/cookiecutter/cookiecutter-django/pull/4114))
|
||||||
|
- Bump webpack-cli from 4.10.0 to 5.0.1 ([#4118](https://github.com/cookiecutter/cookiecutter-django/pull/4118))
|
||||||
|
- Update redis to 4.5.0 ([#4142](https://github.com/cookiecutter/cookiecutter-django/pull/4142))
|
||||||
|
- Update sentry-sdk to 1.15.0 ([#4141](https://github.com/cookiecutter/cookiecutter-django/pull/4141))
|
||||||
|
|
||||||
|
## 2023.02.06
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Change `RequestFactory` to `APIRequestFactory` in tests for API views ([#4110](https://github.com/cookiecutter/cookiecutter-django/pull/4110))
|
||||||
|
### Fixed
|
||||||
|
- Fix django-webpack-loader setup when running tests ([#4128](https://github.com/cookiecutter/cookiecutter-django/pull/4128))
|
||||||
|
### Documentation
|
||||||
|
- Added AWS ECS Full Deployment Article to README ([#2630](https://github.com/cookiecutter/cookiecutter-django/pull/2630))
|
||||||
|
### Updated
|
||||||
|
- Update hiredis to 2.2.1 ([#4123](https://github.com/cookiecutter/cookiecutter-django/pull/4123))
|
||||||
|
- Update tox to 4.4.4 ([#4133](https://github.com/cookiecutter/cookiecutter-django/pull/4133))
|
||||||
|
- Update django to 4.0.9 ([#4134](https://github.com/cookiecutter/cookiecutter-django/pull/4134))
|
||||||
|
- Update django-webpack-loader to 1.8.1 ([#4132](https://github.com/cookiecutter/cookiecutter-django/pull/4132))
|
||||||
|
|
||||||
|
## 2023.02.05
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
- Add note about which service to request when running locally with Docker & Webpack or Gulp ([#4130](https://github.com/cookiecutter/cookiecutter-django/pull/4130))
|
||||||
|
|
||||||
|
## 2023.02.03
|
||||||
|
|
||||||
|
### Updated
|
||||||
|
- Update pre-commit to 3.0.4 ([#4127](https://github.com/cookiecutter/cookiecutter-django/pull/4127))
|
||||||
|
|
||||||
|
## 2023.02.02
|
||||||
|
|
||||||
|
### Updated
|
||||||
|
- Update python-slugify to 8.0.0 ([#4111](https://github.com/cookiecutter/cookiecutter-django/pull/4111))
|
||||||
|
- Update pre-commit to 3.0.3 ([#4121](https://github.com/cookiecutter/cookiecutter-django/pull/4121))
|
||||||
|
- Update black to 23.1.0 ([#4120](https://github.com/cookiecutter/cookiecutter-django/pull/4120))
|
||||||
|
- Update black pre-commit hook ([#4122](https://github.com/cookiecutter/cookiecutter-django/pull/4122))
|
||||||
|
|
||||||
|
## 2023.01.29
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Add Webpack support ([#3623](https://github.com/cookiecutter/cookiecutter-django/pull/3623))
|
||||||
|
- Remove `BrokenLinkEmailsMiddleware` ([#4112](https://github.com/cookiecutter/cookiecutter-django/pull/4112))
|
||||||
|
|
||||||
## 2023.01.28
|
## 2023.01.28
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -642,6 +642,13 @@ Listed in alphabetical order.
|
||||||
</td>
|
</td>
|
||||||
<td>jangeador</td>
|
<td>jangeador</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Delphine LEMIRE</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://github.com/DelphineLemire">DelphineLemire</a>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Demetris Stavrou</td>
|
<td>Demetris Stavrou</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -705,6 +712,13 @@ Listed in alphabetical order.
|
||||||
</td>
|
</td>
|
||||||
<td>dudanogueira</td>
|
<td>dudanogueira</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>duffn</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://github.com/duffn">duffn</a>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dónal Adams</td>
|
<td>Dónal Adams</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -901,6 +915,13 @@ Listed in alphabetical order.
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Hoai-Thu Vuong</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://github.com/thuvh">thuvh</a>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Howie Zhao</td>
|
<td>Howie Zhao</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
[](https://github.com/cookiecutter/cookiecutter-django/actions/workflows/ci.yml?query=branch%3Amaster)
|
[](https://github.com/cookiecutter/cookiecutter-django/actions/workflows/ci.yml?query=branch%3Amaster)
|
||||||
[](https://cookiecutter-django.readthedocs.io/en/latest/?badge=latest)
|
[](https://cookiecutter-django.readthedocs.io/en/latest/?badge=latest)
|
||||||
|
[](https://results.pre-commit.ci/latest/github/cookiecutter/cookiecutter-django/master)
|
||||||
|
[](https://github.com/ambv/black)
|
||||||
|
|
||||||
[](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/)
|
[](https://pyup.io/repos/github/cookiecutter/cookiecutter-django/)
|
||||||
[](https://discord.gg/uFXweDQc5a)
|
[](https://discord.gg/uFXweDQc5a)
|
||||||
[](https://www.codetriage.com/cookiecutter/cookiecutter-django)
|
[](https://www.codetriage.com/cookiecutter/cookiecutter-django)
|
||||||
[](https://github.com/ambv/black)
|
|
||||||
|
|
||||||
Powered by [Cookiecutter](https://github.com/cookiecutter/cookiecutter), Cookiecutter Django is a framework for jumpstarting
|
Powered by [Cookiecutter](https://github.com/cookiecutter/cookiecutter), Cookiecutter Django is a framework for jumpstarting
|
||||||
production-ready Django projects quickly.
|
production-ready Django projects quickly.
|
||||||
|
@ -234,6 +236,7 @@ experience better.
|
||||||
## Articles
|
## Articles
|
||||||
|
|
||||||
- [Cookiecutter Django With Amazon RDS](https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds/) - Apr, 2, 2021
|
- [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
|
- [Using cookiecutter-django with Google Cloud Storage](https://ahhda.github.io/cloud/gce/django/2019/03/12/using-django-cookiecutter-cloud-storage.html) - Mar. 12, 2019
|
||||||
- [cookiecutter-django with Nginx, Route 53 and ELB](https://msaizar.com/blog/cookiecutter-django-nginx-route-53-and-elb/) - Feb. 12, 2018
|
- [cookiecutter-django with Nginx, Route 53 and ELB](https://msaizar.com/blog/cookiecutter-django-nginx-route-53-and-elb/) - Feb. 12, 2018
|
||||||
- [cookiecutter-django and Amazon RDS](https://msaizar.com/blog/cookiecutter-django-and-amazon-rds/) - Feb. 7, 2018
|
- [cookiecutter-django and Amazon RDS](https://msaizar.com/blog/cookiecutter-django-and-amazon-rds/) - Feb. 7, 2018
|
||||||
|
|
|
@ -213,6 +213,11 @@ By default, it's enabled both in local and production environments (``local.yml`
|
||||||
|
|
||||||
.. _`Flower`: https://github.com/mher/flower
|
.. _`Flower`: https://github.com/mher/flower
|
||||||
|
|
||||||
|
Using Webpack or Gulp
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
When using Webpack or Gulp as the ``frontend_pipeline`` option, you should access your application at the address of the ``node`` service in order to see your correct styles. This is http://localhost:3000 by default. When using any of the other ``frontend_pipeline`` options, you should use the address of the ``django`` service, http://localhost:8000.
|
||||||
|
|
||||||
Developing locally with HTTPS
|
Developing locally with HTTPS
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
sphinx==5.3.0
|
sphinx==6.1.3
|
||||||
sphinx-rtd-theme==1.1.1
|
sphinx-rtd-theme==1.2.0
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
cookiecutter==2.1.1
|
cookiecutter==2.1.1
|
||||||
sh==1.14.3; sys_platform != "win32"
|
sh==2.0.2; sys_platform != "win32"
|
||||||
binaryornot==0.4.4
|
binaryornot==0.4.4
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
black==22.12.0
|
black==23.1.0
|
||||||
isort==5.12.0
|
isort==5.12.0
|
||||||
flake8==6.0.0
|
flake8==6.0.0
|
||||||
flake8-isort==6.0.0
|
flake8-isort==6.0.0
|
||||||
pre-commit==3.0.1
|
pre-commit==3.1.0
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
tox==4.4.2
|
tox==4.4.6
|
||||||
pytest==7.2.1
|
pytest==7.2.1
|
||||||
pytest-cookies==0.6.1
|
pytest-cookies==0.6.1
|
||||||
pytest-instafail==0.4.2
|
pytest-instafail==0.4.2
|
||||||
|
@ -20,7 +20,7 @@ pyyaml==6.0
|
||||||
|
|
||||||
# Scripting
|
# Scripting
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
PyGithub==1.57
|
PyGithub==1.58.0
|
||||||
gitpython==3.1.30
|
gitpython==3.1.31
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
requests==2.28.2
|
requests==2.28.2
|
||||||
|
|
|
@ -82,14 +82,20 @@ def group_pulls_by_change_type(
|
||||||
grouped_pulls = {
|
grouped_pulls = {
|
||||||
"Changed": [],
|
"Changed": [],
|
||||||
"Fixed": [],
|
"Fixed": [],
|
||||||
|
"Documentation": [],
|
||||||
"Updated": [],
|
"Updated": [],
|
||||||
}
|
}
|
||||||
for pull in pull_requests_list:
|
for pull in pull_requests_list:
|
||||||
label_names = {label.name for label in pull.labels}
|
label_names = {label.name for label in pull.labels}
|
||||||
|
if "project infrastructure" in label_names:
|
||||||
|
# Don't mention it in the changelog
|
||||||
|
continue
|
||||||
if "update" in label_names:
|
if "update" in label_names:
|
||||||
group_name = "Updated"
|
group_name = "Updated"
|
||||||
elif "bug" in label_names:
|
elif "bug" in label_names:
|
||||||
group_name = "Fixed"
|
group_name = "Fixed"
|
||||||
|
elif "docs" in label_names:
|
||||||
|
group_name = "Documentation"
|
||||||
else:
|
else:
|
||||||
group_name = "Changed"
|
group_name = "Changed"
|
||||||
grouped_pulls[group_name].append(pull)
|
grouped_pulls[group_name].append(pull)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
# We use calendar versioning
|
# We use calendar versioning
|
||||||
version = "2023.01.28"
|
version = "2023.02.17"
|
||||||
|
|
||||||
with open("README.rst") as readme_file:
|
with open("README.rst") as readme_file:
|
||||||
long_description = readme_file.read()
|
long_description = readme_file.read()
|
||||||
|
|
|
@ -27,16 +27,15 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
cache: pip
|
|
||||||
cache-dependency-path: |
|
|
||||||
requirements/base.txt
|
|
||||||
requirements/local.txt
|
|
||||||
|
|
||||||
|
{%- if cookiecutter.open_source_license != 'Not open source' %}
|
||||||
|
# Consider using pre-commit.ci for open source project
|
||||||
|
{%- endif %}
|
||||||
- name: Run pre-commit
|
- name: Run pre-commit
|
||||||
uses: pre-commit/action@v2.0.3
|
uses: pre-commit/action@v3.0.0
|
||||||
|
|
||||||
# With no caching at all the entire ci process takes 4m 30s to complete!
|
# With no caching at all the entire ci process takes 4m 30s to complete!
|
||||||
pytest:
|
pytest:
|
||||||
|
@ -85,7 +84,7 @@ jobs:
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
cache: pip
|
cache: pip
|
||||||
|
|
|
@ -16,7 +16,7 @@ repos:
|
||||||
args: [--py310-plus]
|
args: [--py310-plus]
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.12.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,20 @@ celery -A config.celery_app worker -l info
|
||||||
|
|
||||||
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
|
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
|
||||||
|
|
||||||
|
To run [periodic tasks](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html), you'll need to start the celery beat scheduler service. You can start it as a standalone process:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
cd {{cookiecutter.project_slug}}
|
||||||
|
celery -A config.celery_app beat
|
||||||
|
```
|
||||||
|
|
||||||
|
or you can embed the beat service inside a worker with the `-B` option (not recommended for production use):
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
cd {{cookiecutter.project_slug}}
|
||||||
|
celery -A config.celery_app worker -B -l info
|
||||||
|
```
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_mailhog == "y" %}
|
{%- if cookiecutter.use_mailhog == "y" %}
|
||||||
|
|
||||||
|
|
|
@ -29,5 +29,13 @@ EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405
|
TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405
|
||||||
|
|
||||||
|
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
|
||||||
|
# django-webpack-loader
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
WEBPACK_LOADER["DEFAULT"][ # noqa F405
|
||||||
|
"LOADER_CLASS"
|
||||||
|
] = "webpack_loader.loader.FakeWebpackLoader"
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
# Your stuff...
|
# Your stuff...
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"@babel/preset-env": "^7.16.5",
|
"@babel/preset-env": "^7.16.5",
|
||||||
"@popperjs/core": "^2.10.2",
|
"@popperjs/core": "^2.10.2",
|
||||||
"autoprefixer": "^10.4.0",
|
"autoprefixer": "^10.4.0",
|
||||||
"babel-loader": "^8.2.3",
|
"babel-loader": "^9.1.2",
|
||||||
"bootstrap": "^5.1.3",
|
"bootstrap": "^5.1.3",
|
||||||
"browser-sync": "^2.27.7",
|
"browser-sync": "^2.27.7",
|
||||||
"css-loader": "^6.5.1",
|
"css-loader": "^6.5.1",
|
||||||
|
@ -24,13 +24,13 @@
|
||||||
"node-sass-tilde-importer": "^1.0.2",
|
"node-sass-tilde-importer": "^1.0.2",
|
||||||
"pixrem": "^5.0.0",
|
"pixrem": "^5.0.0",
|
||||||
"postcss": "^8.3.11",
|
"postcss": "^8.3.11",
|
||||||
"postcss-loader": "^6.2.1",
|
"postcss-loader": "^7.0.2",
|
||||||
"postcss-preset-env": "^7.0.2",
|
"postcss-preset-env": "^8.0.1",
|
||||||
"sass": "^1.43.4",
|
"sass": "^1.43.4",
|
||||||
"sass-loader": "^12.4.0",
|
"sass-loader": "^13.2.0",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
"webpack-bundle-tracker": "^1.4.0",
|
"webpack-bundle-tracker": "^1.4.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^5.0.1",
|
||||||
"webpack-dev-server": "^4.6.0",
|
"webpack-dev-server": "^4.6.0",
|
||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pytz==2022.7.1 # 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
|
python-slugify==8.0.1 # https://github.com/un33k/python-slugify
|
||||||
Pillow==9.4.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.frontend_pipeline == 'Django Compressor' %}
|
||||||
{%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %}
|
{%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %}
|
||||||
|
@ -10,11 +10,11 @@ rcssmin==1.1.1 # https://github.com/ndparker/rcssmin
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
|
argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
|
||||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||||
whitenoise==6.3.0 # https://github.com/evansd/whitenoise
|
whitenoise==6.4.0 # https://github.com/evansd/whitenoise
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
redis==4.4.2 # https://github.com/redis/redis-py
|
redis==4.5.1 # https://github.com/redis/redis-py
|
||||||
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
|
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
|
||||||
hiredis==2.1.1 # https://github.com/redis/hiredis-py
|
hiredis==2.2.2 # https://github.com/redis/hiredis-py
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_celery == "y" %}
|
{%- if cookiecutter.use_celery == "y" %}
|
||||||
celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery
|
celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery
|
||||||
|
@ -29,11 +29,11 @@ uvicorn[standard]==0.20.0 # https://github.com/encode/uvicorn
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
django==4.0.8 # pyup: < 4.1 # https://www.djangoproject.com/
|
django==4.0.10 # pyup: < 4.1 # https://www.djangoproject.com/
|
||||||
django-environ==0.9.0 # https://github.com/joke2k/django-environ
|
django-environ==0.9.0 # https://github.com/joke2k/django-environ
|
||||||
django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils
|
django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils
|
||||||
django-allauth==0.52.0 # https://github.com/pennersr/django-allauth
|
django-allauth==0.52.0 # https://github.com/pennersr/django-allauth
|
||||||
django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms
|
django-crispy-forms==2.0 # https://github.com/django-crispy-forms/django-crispy-forms
|
||||||
crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5
|
crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5
|
||||||
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
|
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
|
||||||
django-compressor==4.3.1 # https://github.com/django-compressor/django-compressor
|
django-compressor==4.3.1 # https://github.com/django-compressor/django-compressor
|
||||||
|
@ -42,10 +42,10 @@ django-redis==5.2.0 # https://github.com/jazzband/django-redis
|
||||||
{%- if cookiecutter.use_drf == 'y' %}
|
{%- if cookiecutter.use_drf == 'y' %}
|
||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework
|
djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework
|
||||||
django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers
|
django-cors-headers==3.14.0 # https://github.com/adamchainz/django-cors-headers
|
||||||
# DRF-spectacular for api documentation
|
# DRF-spectacular for api documentation
|
||||||
drf-spectacular==0.25.1 # https://github.com/tfranzel/drf-spectacular
|
drf-spectacular==0.25.1 # https://github.com/tfranzel/drf-spectacular
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
|
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
|
||||||
django-webpack-loader==1.8.0 # https://github.com/django-webpack/django-webpack-loader
|
django-webpack-loader==1.8.1 # https://github.com/django-webpack/django-webpack-loader
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-r base.txt
|
-r base.txt
|
||||||
|
|
||||||
Werkzeug[watchdog]==2.2.2 # https://github.com/pallets/werkzeug
|
Werkzeug[watchdog]==2.2.3 # https://github.com/pallets/werkzeug
|
||||||
ipdb==0.13.11 # https://github.com/gotcha/ipdb
|
ipdb==0.13.11 # https://github.com/gotcha/ipdb
|
||||||
{%- if cookiecutter.use_docker == 'y' %}
|
{%- if cookiecutter.use_docker == 'y' %}
|
||||||
psycopg2==2.9.5 # https://github.com/psycopg/psycopg2
|
psycopg2==2.9.5 # https://github.com/psycopg/psycopg2
|
||||||
|
@ -13,30 +13,30 @@ watchfiles==0.18.1 # https://github.com/samuelcolvin/watchfiles
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
mypy==0.982 # https://github.com/python/mypy
|
mypy==1.0.1 # https://github.com/python/mypy
|
||||||
django-stubs==1.14.0 # https://github.com/typeddjango/django-stubs
|
django-stubs==1.15.0 # https://github.com/typeddjango/django-stubs
|
||||||
pytest==7.2.1 # https://github.com/pytest-dev/pytest
|
pytest==7.2.1 # https://github.com/pytest-dev/pytest
|
||||||
pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar
|
pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar
|
||||||
{%- if cookiecutter.use_drf == "y" %}
|
{%- if cookiecutter.use_drf == "y" %}
|
||||||
djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs
|
djangorestframework-stubs==1.9.1 # https://github.com/typeddjango/djangorestframework-stubs
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
sphinx==5.3.0 # https://github.com/sphinx-doc/sphinx
|
sphinx==6.1.3 # https://github.com/sphinx-doc/sphinx
|
||||||
sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild
|
sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
flake8==6.0.0 # https://github.com/PyCQA/flake8
|
flake8==6.0.0 # https://github.com/PyCQA/flake8
|
||||||
flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort
|
flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort
|
||||||
coverage==7.1.0 # https://github.com/nedbat/coveragepy
|
coverage==7.2.0 # https://github.com/nedbat/coveragepy
|
||||||
black==22.12.0 # https://github.com/psf/black
|
black==23.1.0 # https://github.com/psf/black
|
||||||
pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django
|
pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django
|
||||||
{%- if cookiecutter.use_celery == 'y' %}
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
|
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
pre-commit==3.0.1 # https://github.com/pre-commit/pre-commit
|
pre-commit==3.1.0 # https://github.com/pre-commit/pre-commit
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -8,10 +8,10 @@ psycopg2==2.9.5 # https://github.com/psycopg/psycopg2
|
||||||
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
|
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_sentry == "y" %}
|
{%- if cookiecutter.use_sentry == "y" %}
|
||||||
sentry-sdk==1.14.0 # https://github.com/getsentry/sentry-python
|
sentry-sdk==1.15.0 # https://github.com/getsentry/sentry-python
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
|
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
|
||||||
hiredis==2.1.1 # https://github.com/redis/hiredis-py
|
hiredis==2.2.2 # https://github.com/redis/hiredis-py
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
|
|
|
@ -10,7 +10,6 @@ User = get_user_model()
|
||||||
|
|
||||||
@admin.register(User)
|
@admin.register(User)
|
||||||
class UserAdmin(auth_admin.UserAdmin):
|
class UserAdmin(auth_admin.UserAdmin):
|
||||||
|
|
||||||
form = UserAdminChangeForm
|
form = UserAdminChangeForm
|
||||||
add_form = UserAdminCreationForm
|
add_form = UserAdminCreationForm
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
|
|
|
@ -7,7 +7,6 @@ from factory.django import DjangoModelFactory
|
||||||
|
|
||||||
|
|
||||||
class UserFactory(DjangoModelFactory):
|
class UserFactory(DjangoModelFactory):
|
||||||
|
|
||||||
username = Faker("user_name")
|
username = Faker("user_name")
|
||||||
email = Faker("email")
|
email = Faker("email")
|
||||||
name = Faker("name")
|
name = Faker("name")
|
||||||
|
|
|
@ -1,27 +1,32 @@
|
||||||
from django.test import RequestFactory
|
import pytest
|
||||||
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet
|
from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet
|
||||||
from {{ cookiecutter.project_slug }}.users.models import User
|
from {{ cookiecutter.project_slug }}.users.models import User
|
||||||
|
|
||||||
|
|
||||||
class TestUserViewSet:
|
class TestUserViewSet:
|
||||||
def test_get_queryset(self, user: User, rf: RequestFactory):
|
@pytest.fixture
|
||||||
|
def api_rf(self) -> APIRequestFactory:
|
||||||
|
return APIRequestFactory()
|
||||||
|
|
||||||
|
def test_get_queryset(self, user: User, api_rf: APIRequestFactory):
|
||||||
view = UserViewSet()
|
view = UserViewSet()
|
||||||
request = rf.get("/fake-url/")
|
request = api_rf.get("/fake-url/")
|
||||||
request.user = user
|
request.user = user
|
||||||
|
|
||||||
view.request = request
|
view.request = request
|
||||||
|
|
||||||
assert user in view.get_queryset()
|
assert user in view.get_queryset()
|
||||||
|
|
||||||
def test_me(self, user: User, rf: RequestFactory):
|
def test_me(self, user: User, api_rf: APIRequestFactory):
|
||||||
view = UserViewSet()
|
view = UserViewSet()
|
||||||
request = rf.get("/fake-url/")
|
request = api_rf.get("/fake-url/")
|
||||||
request.user = user
|
request.user = user
|
||||||
|
|
||||||
view.request = request
|
view.request = request
|
||||||
|
|
||||||
response = view.me(request)
|
response = view.me(request) # type: ignore
|
||||||
|
|
||||||
assert response.data == {
|
assert response.data == {
|
||||||
"username": user.username,
|
"username": user.username,
|
||||||
|
|
|
@ -9,7 +9,6 @@ User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class UserDetailView(LoginRequiredMixin, DetailView):
|
class UserDetailView(LoginRequiredMixin, DetailView):
|
||||||
|
|
||||||
model = User
|
model = User
|
||||||
slug_field = "username"
|
slug_field = "username"
|
||||||
slug_url_kwarg = "username"
|
slug_url_kwarg = "username"
|
||||||
|
@ -19,7 +18,6 @@ user_detail_view = UserDetailView.as_view()
|
||||||
|
|
||||||
|
|
||||||
class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
|
class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
|
||||||
|
|
||||||
model = User
|
model = User
|
||||||
fields = ["name"]
|
fields = ["name"]
|
||||||
success_message = _("Information successfully updated")
|
success_message = _("Information successfully updated")
|
||||||
|
@ -38,7 +36,6 @@ user_update_view = UserUpdateView.as_view()
|
||||||
|
|
||||||
|
|
||||||
class UserRedirectView(LoginRequiredMixin, RedirectView):
|
class UserRedirectView(LoginRequiredMixin, RedirectView):
|
||||||
|
|
||||||
permanent = False
|
permanent = False
|
||||||
|
|
||||||
def get_redirect_url(self):
|
def get_redirect_url(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user