django-resonant-settings 0.29__py3-none-any.whl → 0.32.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/METADATA +5 -3
- {django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/RECORD +13 -13
- resonant_settings/allauth_support/createsuperuser.py +9 -5
- resonant_settings/allauth_support/management/commands/createsuperuser.py +5 -1
- resonant_settings/allauth_support/receiver.py +3 -2
- resonant_settings/allauth_support/utils.py +3 -1
- resonant_settings/celery.py +7 -3
- resonant_settings/development/celery.py +5 -0
- resonant_settings/testing/minio_storage.py +3 -1
- {django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/WHEEL +0 -0
- {django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/licenses/LICENSE +0 -0
- /resonant_settings/{debug_toolbar.py → development/debug_toolbar.py} +0 -0
- /resonant_settings/{development/extensions.py → django_extensions.py} +0 -0
{django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/METADATA
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-resonant-settings
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.32.1
|
|
4
4
|
Summary: Shared Django settings for Resonant applications.
|
|
5
5
|
Project-URL: Repository, https://github.com/kitware-resonant/cookiecutter-resonant
|
|
6
6
|
Project-URL: Bug Reports, https://github.com/kitware-resonant/cookiecutter-resonant/issues
|
|
7
7
|
Maintainer-email: "Kitware, Inc." <kitware@kitware.com>
|
|
8
|
-
License: Apache
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Keywords: django,resonant,setting,settings
|
|
11
11
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -13,8 +13,8 @@ Classifier: Environment :: Web Environment
|
|
|
13
13
|
Classifier: Framework :: Django
|
|
14
14
|
Classifier: Framework :: Django :: 5
|
|
15
15
|
Classifier: Framework :: Django :: 5.1
|
|
16
|
+
Classifier: Framework :: Django :: 5.2
|
|
16
17
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
18
|
Classifier: Operating System :: OS Independent
|
|
19
19
|
Classifier: Programming Language :: Python
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -26,6 +26,8 @@ Requires-Python: >=3.10
|
|
|
26
26
|
Requires-Dist: django-environ
|
|
27
27
|
Provides-Extra: allauth
|
|
28
28
|
Requires-Dist: django-allauth; extra == 'allauth'
|
|
29
|
+
Provides-Extra: celery
|
|
30
|
+
Requires-Dist: celery; extra == 'celery'
|
|
29
31
|
Description-Content-Type: text/markdown
|
|
30
32
|
|
|
31
33
|
# django-resonant-settings
|
{django_resonant_settings-0.29.dist-info → django_resonant_settings-0.32.1.dist-info}/RECORD
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
resonant_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
resonant_settings/_env.py,sha256=TA97UtDkh7tgBIPc92Osj4FtrBfzMTCmBQ6UR1dPHEk,36
|
|
3
3
|
resonant_settings/allauth.py,sha256=jhAu6SqCUarWiHCrHUcED_2ewBJLpScXAZncYuLKISc,1766
|
|
4
|
-
resonant_settings/celery.py,sha256=
|
|
5
|
-
resonant_settings/debug_toolbar.py,sha256=GhIMbjYsHjiRhrRF6qhYwg-f4gqfO_9OPtD9x-wXz2o,427
|
|
4
|
+
resonant_settings/celery.py,sha256=G2-MnaEmX2zhJhXqHm9SuaOFbbVwpIGaM0vTNzyYHo4,3152
|
|
6
5
|
resonant_settings/django.py,sha256=x7YKyP3KTiit_lPGpGYyepFg9gWKQEIXmCyHnCOBYZs,1500
|
|
6
|
+
resonant_settings/django_extensions.py,sha256=kHXU3m4DyM2o8mS3peJ0YcvDeHu3g0Hsq1PzH5K4DrU,208
|
|
7
7
|
resonant_settings/logging.py,sha256=sPjCN-vvLqozCOpDMKiZ-S9AWzaxH_S7LCuyuc7js4A,2811
|
|
8
8
|
resonant_settings/oauth_toolkit.py,sha256=_3nArvejI97bdzowOPdV1oniBY0goJ9Jg_Rul1CJLGY,1641
|
|
9
9
|
resonant_settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -11,20 +11,20 @@ resonant_settings/rest_framework.py,sha256=xMp9uXmHYhlN9UKiv2KtJkivnv85bIsh1VaHv
|
|
|
11
11
|
resonant_settings/allauth_support/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
resonant_settings/allauth_support/adapter.py,sha256=GSyublJa-2ZCIY_Adb2A0NOoVAtZUuZxB9ZkA5nl66o,395
|
|
13
13
|
resonant_settings/allauth_support/apps.py,sha256=aMx4hSBL9xOMTr5E93rjsW5QUi6m2iNFuz_Ld4isihA,184
|
|
14
|
-
resonant_settings/allauth_support/createsuperuser.py,sha256=
|
|
15
|
-
resonant_settings/allauth_support/receiver.py,sha256=
|
|
16
|
-
resonant_settings/allauth_support/utils.py,sha256=
|
|
17
|
-
resonant_settings/allauth_support/management/commands/createsuperuser.py,sha256=
|
|
14
|
+
resonant_settings/allauth_support/createsuperuser.py,sha256=tnv1BxKJ_5m635F-9m9qswd7t8WIZYedte-AdqEG5J8,3069
|
|
15
|
+
resonant_settings/allauth_support/receiver.py,sha256=NlMMLIIWsz-psIgaqKltsjP9H76czu1OAIseYvtDYiI,1609
|
|
16
|
+
resonant_settings/allauth_support/utils.py,sha256=1nhH8p8-YqdUUoHQixxYIANveKAqaNE8phzvN3abNp0,497
|
|
17
|
+
resonant_settings/allauth_support/management/commands/createsuperuser.py,sha256=61gF3oxhYXbnn49w78rl9SvZOE28tSLmBNVmGNOaexQ,1423
|
|
18
18
|
resonant_settings/development/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
resonant_settings/development/celery.py,sha256=
|
|
20
|
-
resonant_settings/development/
|
|
19
|
+
resonant_settings/development/celery.py,sha256=6t4hEjf9q6XOT-qiS3BgJViOjOJ1etiPwxghhpB4118,519
|
|
20
|
+
resonant_settings/development/debug_toolbar.py,sha256=GhIMbjYsHjiRhrRF6qhYwg-f4gqfO_9OPtD9x-wXz2o,427
|
|
21
21
|
resonant_settings/production/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
resonant_settings/production/email.py,sha256=EQJ7f9jhcu4NxnBa1Wo0gs7JFqaUB87_ETHbVdUo8HY,623
|
|
23
23
|
resonant_settings/production/https.py,sha256=2mru4jteqwW4z1AJJwvqy5sZhpxTh-9OidHOb94X1vY,860
|
|
24
24
|
resonant_settings/production/s3_storage.py,sha256=MDqpxX92t91E50Or_cMXpPzR40OuN52QrGcYJYRmXCQ,968
|
|
25
25
|
resonant_settings/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
resonant_settings/testing/minio_storage.py,sha256=
|
|
27
|
-
django_resonant_settings-0.
|
|
28
|
-
django_resonant_settings-0.
|
|
29
|
-
django_resonant_settings-0.
|
|
30
|
-
django_resonant_settings-0.
|
|
26
|
+
resonant_settings/testing/minio_storage.py,sha256=4FIC3ZHyfej8IgbSgylFqXOcNx_-_sTUlCoBZLkeLYs,1002
|
|
27
|
+
django_resonant_settings-0.32.1.dist-info/METADATA,sha256=Mz3h15nFWLOMZmBE_K2_hjMjoQXKEOLv6nGfBmTzuew,1720
|
|
28
|
+
django_resonant_settings-0.32.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
django_resonant_settings-0.32.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
30
|
+
django_resonant_settings-0.32.1.dist-info/RECORD,,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import ClassVar
|
|
3
|
+
from typing import Any, ClassVar
|
|
4
4
|
|
|
5
5
|
from django.contrib.auth.management.commands import createsuperuser
|
|
6
6
|
from django.contrib.auth.models import User, UserManager
|
|
@@ -9,12 +9,14 @@ from resonant_settings.allauth_support.utils import temporarily_change_attribute
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Command(createsuperuser.Command):
|
|
12
|
-
def __init__(self, *args, **kwargs):
|
|
12
|
+
def __init__(self, *args: Any, **kwargs: Any):
|
|
13
13
|
super().__init__(*args, **kwargs)
|
|
14
14
|
self.UserModel = EmailAsUsernameProxyUser
|
|
15
15
|
self.username_field = self.UserModel._meta.get_field(self.UserModel.USERNAME_FIELD)
|
|
16
16
|
|
|
17
|
-
def _validate_username(
|
|
17
|
+
def _validate_username(
|
|
18
|
+
self, username: str, verbose_field_name: str, database: str
|
|
19
|
+
) -> str | None:
|
|
18
20
|
# Since "username" is actually unique, "email" (i.e. "self.username_field") is logically
|
|
19
21
|
# unique too. Explicitly setting the "_unique" attribute ensures that app-level duplicate
|
|
20
22
|
# checking is done by "_validate_username", which produces better, earlier error messages.
|
|
@@ -23,7 +25,9 @@ class Command(createsuperuser.Command):
|
|
|
23
25
|
with temporarily_change_attributes(self.username_field, _unique=True):
|
|
24
26
|
# Normalize (as it would be done before saving) for better duplicate detection
|
|
25
27
|
username = self.UserModel.normalize_username(username)
|
|
26
|
-
return super()._validate_username(
|
|
28
|
+
return super()._validate_username( # type: ignore[misc]
|
|
29
|
+
username, verbose_field_name, database
|
|
30
|
+
)
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
class EmailAsUsernameProxyUserManager(UserManager):
|
|
@@ -33,7 +37,7 @@ class EmailAsUsernameProxyUserManager(UserManager):
|
|
|
33
37
|
username: str | None = None,
|
|
34
38
|
email: str | None = None,
|
|
35
39
|
password: str | None = None,
|
|
36
|
-
**extra_fields,
|
|
40
|
+
**extra_fields: Any,
|
|
37
41
|
) -> EmailAsUsernameProxyUser:
|
|
38
42
|
# Practically, email will always be provided
|
|
39
43
|
assert email
|
|
@@ -15,8 +15,12 @@ When Allauth is configured to use a User's `email` as the `username`, override t
|
|
|
15
15
|
management command to only prompt for an email address.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
+
username_required: bool | None = allauth_settings.SIGNUP_FIELDS.get("username", {}).get(
|
|
19
|
+
"required", None
|
|
20
|
+
)
|
|
21
|
+
|
|
18
22
|
# If using email as username
|
|
19
|
-
if not
|
|
23
|
+
if not username_required:
|
|
20
24
|
# Expose the modified command
|
|
21
25
|
Command: type[BaseCommand] = allauth_support_createsuperuser.Command
|
|
22
26
|
user_model: type[AbstractUser] = allauth_support_createsuperuser.EmailAsUsernameProxyUser
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from typing import Any
|
|
2
3
|
|
|
3
4
|
from allauth.account.models import EmailAddress
|
|
4
5
|
from django.contrib.auth.models import AbstractUser
|
|
@@ -10,8 +11,8 @@ def verify_email_address_on_user_post_save(
|
|
|
10
11
|
sender: type[AbstractUser],
|
|
11
12
|
instance: AbstractUser,
|
|
12
13
|
created: bool,
|
|
13
|
-
**kwargs,
|
|
14
|
-
):
|
|
14
|
+
**kwargs: Any,
|
|
15
|
+
) -> None:
|
|
15
16
|
"""Automatically verify email addresses of newly created superusers."""
|
|
16
17
|
# These should always be true, but it's a final sanity check
|
|
17
18
|
if created and instance.is_superuser:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
from collections.abc import Generator
|
|
1
2
|
from contextlib import contextmanager
|
|
3
|
+
from typing import Any
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
# From https://stackoverflow.com/a/38532086
|
|
5
7
|
@contextmanager
|
|
6
|
-
def temporarily_change_attributes(something, **kwargs):
|
|
8
|
+
def temporarily_change_attributes(something: object, **kwargs: Any) -> Generator[None]:
|
|
7
9
|
previous_values = {k: getattr(something, k) for k in kwargs}
|
|
8
10
|
for k, v in kwargs.items():
|
|
9
11
|
setattr(something, k, v)
|
resonant_settings/celery.py
CHANGED
|
@@ -7,6 +7,8 @@ Configure Celery with the following features:
|
|
|
7
7
|
This requires the `celery` package to be installed.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
import celery.app.trace # type: ignore[import-not-found]
|
|
11
|
+
|
|
10
12
|
from resonant_settings._env import env
|
|
11
13
|
|
|
12
14
|
# Assume AMQP.
|
|
@@ -45,9 +47,6 @@ CELERY_TASK_ACKS_ON_FAILURE_OR_TIMEOUT = True
|
|
|
45
47
|
# and this will be Celery's default in 6.0.
|
|
46
48
|
CELERY_WORKER_CANCEL_LONG_RUNNING_TASKS_ON_CONNECTION_LOSS = True
|
|
47
49
|
|
|
48
|
-
# This is the default, but is necessary to suppress warnings in Celery
|
|
49
|
-
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
|
|
50
|
-
|
|
51
50
|
# CloudAMQP-suggested settings
|
|
52
51
|
# https://www.cloudamqp.com/docs/celery.html
|
|
53
52
|
CELERY_BROKER_POOL_LIMIT = 1
|
|
@@ -65,3 +64,8 @@ CELERY_WORKER_PREFETCH_MULTIPLIER = 1
|
|
|
65
64
|
# Accept the default of the number of CPU cores.
|
|
66
65
|
# Workers running memory-intensive tasks may need to decrease this.
|
|
67
66
|
CELERY_WORKER_CONCURRENCY: int | None = None
|
|
67
|
+
|
|
68
|
+
# Make the task received log message include the task's arguments.
|
|
69
|
+
celery.app.trace.LOG_RECEIVED = """\
|
|
70
|
+
Task %(name)s[%(id)s] received: (%(args)s, %(kwargs)s)\
|
|
71
|
+
"""
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
from resonant_settings._env import env
|
|
2
|
+
|
|
1
3
|
# Acknowledge early in development, which will help prevent failing or
|
|
2
4
|
# long-running tasks from being started automatically every time the worker
|
|
3
5
|
# process restarts; this more aggressively flushes the task queue.
|
|
4
6
|
CELERY_TASK_ACKS_LATE = False
|
|
5
7
|
|
|
8
|
+
CELERY_TASK_ALWAYS_EAGER: bool = env.bool("DJANGO_CELERY_TASK_ALWAYS_EAGER", default=False)
|
|
9
|
+
CELERY_TASK_EAGER_PROPAGATES = CELERY_TASK_ALWAYS_EAGER
|
|
10
|
+
|
|
6
11
|
# In development, run without concurrency.
|
|
7
12
|
CELERY_WORKER_CONCURRENCY: int | None = 1
|
|
@@ -22,5 +22,7 @@ MINIO_STORAGE_MEDIA_BUCKET_NAME = minio_url.path.lstrip("/")
|
|
|
22
22
|
MINIO_STORAGE_MEDIA_URL: str | None = env.str("DJANGO_MINIO_STORAGE_MEDIA_URL", default=None)
|
|
23
23
|
|
|
24
24
|
MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True
|
|
25
|
-
|
|
25
|
+
# Make the bucket private to the public
|
|
26
|
+
MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY = "NONE"
|
|
27
|
+
# Issue signed URLs to provide any read access
|
|
26
28
|
MINIO_STORAGE_MEDIA_USE_PRESIGNED = True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|