django-cfg 1.4.107__py3-none-any.whl → 1.4.109__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.
Potentially problematic release.
This version of django-cfg might be problematic. Click here for more details.
- django_cfg/__init__.py +1 -1
- django_cfg/apps/accounts/views/profile.py +19 -9
- django_cfg/apps/centrifugo/views/admin_api.py +4 -7
- django_cfg/apps/centrifugo/views/monitoring.py +3 -6
- django_cfg/apps/centrifugo/views/testing_api.py +3 -6
- django_cfg/apps/dashboard/services/system_health_service.py +16 -11
- django_cfg/apps/dashboard/views/activity_views.py +3 -5
- django_cfg/apps/dashboard/views/apizones_views.py +4 -5
- django_cfg/apps/dashboard/views/charts_views.py +4 -5
- django_cfg/apps/dashboard/views/overview_views.py +4 -5
- django_cfg/apps/dashboard/views/statistics_views.py +4 -5
- django_cfg/apps/dashboard/views/system_views.py +4 -5
- django_cfg/apps/knowbase/__init__.py +2 -2
- django_cfg/apps/knowbase/apps.py +2 -8
- django_cfg/apps/knowbase/views/base.py +9 -4
- django_cfg/apps/support/views/api.py +16 -7
- django_cfg/apps/tasks/__init__.py +61 -2
- django_cfg/apps/tasks/admin/__init__.py +3 -10
- django_cfg/apps/tasks/admin/config.py +98 -0
- django_cfg/apps/tasks/admin/task_log.py +265 -0
- django_cfg/apps/tasks/apps.py +7 -9
- django_cfg/apps/tasks/filters/__init__.py +10 -0
- django_cfg/apps/tasks/filters/task_log.py +121 -0
- django_cfg/apps/tasks/migrations/0001_initial.py +196 -0
- django_cfg/apps/tasks/models/__init__.py +4 -0
- django_cfg/apps/tasks/models/task_log.py +246 -0
- django_cfg/apps/tasks/serializers/__init__.py +28 -0
- django_cfg/apps/tasks/serializers/task_log.py +249 -0
- django_cfg/apps/tasks/services/__init__.py +10 -0
- django_cfg/apps/tasks/services/client/__init__.py +7 -0
- django_cfg/apps/tasks/services/client/client.py +234 -0
- django_cfg/apps/tasks/services/config_helper.py +63 -0
- django_cfg/apps/tasks/services/sync.py +204 -0
- django_cfg/apps/tasks/urls.py +7 -13
- django_cfg/apps/tasks/views/__init__.py +4 -10
- django_cfg/apps/tasks/views/task_log.py +41 -0
- django_cfg/apps/tasks/views/task_log_base.py +41 -0
- django_cfg/apps/tasks/views/task_log_overview.py +100 -0
- django_cfg/apps/tasks/views/task_log_related.py +41 -0
- django_cfg/apps/tasks/views/task_log_stats.py +91 -0
- django_cfg/apps/tasks/views/task_log_timeline.py +81 -0
- django_cfg/apps/urls.py +0 -1
- django_cfg/cli/commands/info.py +1 -1
- django_cfg/cli/utils.py +1 -1
- django_cfg/core/base/config_model.py +1 -1
- django_cfg/core/builders/apps_builder.py +1 -1
- django_cfg/core/generation/integration_generators/__init__.py +1 -1
- django_cfg/core/generation/integration_generators/tasks.py +14 -18
- django_cfg/core/generation/security_generators/crypto_fields.py +2 -1
- django_cfg/core/integration/display/startup.py +1 -1
- django_cfg/mixins/__init__.py +12 -0
- django_cfg/mixins/admin_api.py +37 -0
- django_cfg/mixins/client_api.py +39 -0
- django_cfg/models/django/constance.py +2 -8
- django_cfg/models/django/crypto_fields.py +13 -48
- django_cfg/models/tasks/__init__.py +8 -10
- django_cfg/models/tasks/backends.py +76 -207
- django_cfg/models/tasks/config.py +20 -127
- django_cfg/models/tasks/utils.py +17 -29
- django_cfg/modules/django_client/management/commands/generate_client.py +13 -1
- django_cfg/modules/django_unfold/navigation.py +121 -22
- django_cfg/pyproject.toml +2 -2
- django_cfg/registry/core.py +1 -1
- django_cfg/static/frontend/admin.zip +0 -0
- {django_cfg-1.4.107.dist-info → django_cfg-1.4.109.dist-info}/METADATA +3 -3
- {django_cfg-1.4.107.dist-info → django_cfg-1.4.109.dist-info}/RECORD +70 -117
- django_cfg/apps/tasks/admin/actions.py +0 -29
- django_cfg/apps/tasks/admin/tasks_admin.py +0 -154
- django_cfg/apps/tasks/api/serializers.py +0 -82
- django_cfg/apps/tasks/api/views.py +0 -571
- django_cfg/apps/tasks/serializers.py +0 -82
- django_cfg/apps/tasks/static/tasks/css/dashboard-alpine.css +0 -299
- django_cfg/apps/tasks/static/tasks/css/dashboard.css +0 -120
- django_cfg/apps/tasks/static/tasks/js/alpine/README.md +0 -47
- django_cfg/apps/tasks/static/tasks/js/alpine/actions/index.js +0 -8
- django_cfg/apps/tasks/static/tasks/js/alpine/actions/management.js +0 -123
- django_cfg/apps/tasks/static/tasks/js/alpine/actions/pagination.js +0 -21
- django_cfg/apps/tasks/static/tasks/js/alpine/actions/tasks.js +0 -101
- django_cfg/apps/tasks/static/tasks/js/alpine/actions/workers.js +0 -59
- django_cfg/apps/tasks/static/tasks/js/alpine/computed.js +0 -35
- django_cfg/apps/tasks/static/tasks/js/alpine/index.js +0 -148
- django_cfg/apps/tasks/static/tasks/js/alpine/loaders/index.js +0 -36
- django_cfg/apps/tasks/static/tasks/js/alpine/loaders/overview.js +0 -37
- django_cfg/apps/tasks/static/tasks/js/alpine/loaders/queues.js +0 -27
- django_cfg/apps/tasks/static/tasks/js/alpine/loaders/tasks.js +0 -32
- django_cfg/apps/tasks/static/tasks/js/alpine/loaders/workers.js +0 -21
- django_cfg/apps/tasks/static/tasks/js/alpine/state.js +0 -36
- django_cfg/apps/tasks/static/tasks/js/alpine/utils/formatters.js +0 -42
- django_cfg/apps/tasks/static/tasks/js/alpine/utils/helpers.js +0 -68
- django_cfg/apps/tasks/static/tasks/js/dashboard-alpine.js +0 -725
- django_cfg/apps/tasks/tasks/__init__.py +0 -10
- django_cfg/apps/tasks/tasks/demo_tasks.py +0 -127
- django_cfg/apps/tasks/templates/tasks/components/management_actions.html +0 -71
- django_cfg/apps/tasks/templates/tasks/components/overview_content.html +0 -94
- django_cfg/apps/tasks/templates/tasks/components/queues_content.html +0 -44
- django_cfg/apps/tasks/templates/tasks/components/tab_navigation.html +0 -45
- django_cfg/apps/tasks/templates/tasks/components/task_details_modal.html +0 -151
- django_cfg/apps/tasks/templates/tasks/components/tasks_content.html +0 -61
- django_cfg/apps/tasks/templates/tasks/components/tasks_mjs_integration.html +0 -269
- django_cfg/apps/tasks/templates/tasks/components/workers_content.html +0 -60
- django_cfg/apps/tasks/templates/tasks/layout/base.html +0 -20
- django_cfg/apps/tasks/templates/tasks/pages/dashboard-improved.html +0 -168
- django_cfg/apps/tasks/templates/tasks/pages/dashboard.html +0 -77
- django_cfg/apps/tasks/templates/tasks/partials/task_row_template.html +0 -40
- django_cfg/apps/tasks/templates/tasks/widgets/task_filters.html +0 -40
- django_cfg/apps/tasks/templates/tasks/widgets/task_footer.html +0 -86
- django_cfg/apps/tasks/templates/tasks/widgets/task_table.html +0 -90
- django_cfg/apps/tasks/urls_admin.py +0 -15
- django_cfg/apps/tasks/utils/__init__.py +0 -1
- django_cfg/apps/tasks/utils/simulator.py +0 -353
- django_cfg/apps/tasks/views/api.py +0 -571
- django_cfg/apps/tasks/views/dashboard.py +0 -89
- django_cfg/management/commands/rundramatiq.py +0 -24
- django_cfg/management/commands/rundramatiq_simulator.py +0 -22
- django_cfg/management/commands/task_clear.py +0 -25
- django_cfg/management/commands/task_status.py +0 -24
- django_cfg/modules/django_client/system/__init__.py +0 -24
- django_cfg/modules/django_client/system/base_generator.py +0 -123
- django_cfg/modules/django_client/system/generate_mjs_clients.py +0 -176
- django_cfg/modules/django_client/system/mjs_generator.py +0 -219
- django_cfg/modules/django_client/system/schema_parser.py +0 -199
- django_cfg/modules/django_client/system/templates/api_client.js.j2 +0 -87
- django_cfg/modules/django_client/system/templates/app_index.js.j2 +0 -13
- django_cfg/modules/django_client/system/templates/base_client.js.j2 +0 -166
- django_cfg/modules/django_client/system/templates/main_index.js.j2 +0 -80
- django_cfg/modules/django_client/system/templates/types.js.j2 +0 -24
- django_cfg/modules/django_tasks/__init__.py +0 -29
- django_cfg/modules/django_tasks/dramatiq_setup.py +0 -20
- django_cfg/modules/django_tasks/factory.py +0 -127
- django_cfg/modules/django_tasks/management/commands/__init__.py +0 -0
- django_cfg/modules/django_tasks/management/commands/rundramatiq.py +0 -253
- django_cfg/modules/django_tasks/management/commands/rundramatiq_simulator.py +0 -436
- django_cfg/modules/django_tasks/management/commands/task_clear.py +0 -226
- django_cfg/modules/django_tasks/management/commands/task_status.py +0 -257
- django_cfg/modules/django_tasks/service.py +0 -281
- django_cfg/modules/django_tasks/settings.py +0 -107
- /django_cfg/{modules/django_tasks/management → apps/tasks/migrations}/__init__.py +0 -0
- {django_cfg-1.4.107.dist-info → django_cfg-1.4.109.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.107.dist-info → django_cfg-1.4.109.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.107.dist-info → django_cfg-1.4.109.dist-info}/licenses/LICENSE +0 -0
|
@@ -315,7 +315,7 @@ class DjangoConfig(BaseModel):
|
|
|
315
315
|
# === Background Task Processing ===
|
|
316
316
|
tasks: Optional[TaskConfig] = Field(
|
|
317
317
|
default=None,
|
|
318
|
-
description="Background task processing configuration (
|
|
318
|
+
description="Background task processing configuration (ReArq)",
|
|
319
319
|
)
|
|
320
320
|
|
|
321
321
|
# === Centrifugo Configuration ===
|
|
@@ -160,7 +160,7 @@ class InstalledAppsBuilder:
|
|
|
160
160
|
|
|
161
161
|
# Auto-enable tasks if needed by other features
|
|
162
162
|
if self.config.should_enable_tasks():
|
|
163
|
-
|
|
163
|
+
# No external app needed - ReArq is embedded
|
|
164
164
|
apps.append("django_cfg.apps.tasks")
|
|
165
165
|
|
|
166
166
|
# Add DRF Tailwind theme module (uses Tailwind via CDN)
|
|
@@ -5,7 +5,7 @@ Contains generators for third-party integrations and frameworks:
|
|
|
5
5
|
- Session configuration
|
|
6
6
|
- External services (Telegram, Unfold, Constance)
|
|
7
7
|
- API frameworks (JWT, DRF, Spectacular, OpenAPI Client)
|
|
8
|
-
- Background tasks (
|
|
8
|
+
- Background tasks (ReArq)
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
from .api import APIFrameworksGenerator
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Background tasks generator.
|
|
3
3
|
|
|
4
|
-
Handles
|
|
4
|
+
Handles ReArq task queue configuration.
|
|
5
5
|
Size: ~100 lines (focused on task processing)
|
|
6
6
|
"""
|
|
7
7
|
|
|
@@ -19,7 +19,7 @@ class TasksSettingsGenerator:
|
|
|
19
19
|
Generates background task processing settings.
|
|
20
20
|
|
|
21
21
|
Responsibilities:
|
|
22
|
-
- Configure
|
|
22
|
+
- Configure ReArq task queue
|
|
23
23
|
- Auto-detect if tasks should be enabled
|
|
24
24
|
- Set up task configuration
|
|
25
25
|
|
|
@@ -44,7 +44,7 @@ class TasksSettingsGenerator:
|
|
|
44
44
|
Generate task processing settings.
|
|
45
45
|
|
|
46
46
|
Returns:
|
|
47
|
-
Dictionary with
|
|
47
|
+
Dictionary with ReArq configuration
|
|
48
48
|
|
|
49
49
|
Example:
|
|
50
50
|
>>> generator = TasksSettingsGenerator(config)
|
|
@@ -52,41 +52,37 @@ class TasksSettingsGenerator:
|
|
|
52
52
|
"""
|
|
53
53
|
# Check if tasks should be enabled
|
|
54
54
|
if not self.config.should_enable_tasks():
|
|
55
|
-
logger.debug("⏭️
|
|
55
|
+
logger.debug("⏭️ Tasks disabled")
|
|
56
56
|
return {}
|
|
57
57
|
|
|
58
58
|
try:
|
|
59
|
-
return self.
|
|
59
|
+
return self._generate_rearq_settings()
|
|
60
60
|
except ImportError as e:
|
|
61
|
-
logger.warning(f"Failed to import
|
|
61
|
+
logger.warning(f"Failed to import ReArq: {e}")
|
|
62
62
|
return {}
|
|
63
63
|
except Exception as e:
|
|
64
|
-
logger.error(f"Failed to generate
|
|
64
|
+
logger.error(f"Failed to generate ReArq settings: {e}")
|
|
65
65
|
return {}
|
|
66
66
|
|
|
67
|
-
def
|
|
67
|
+
def _generate_rearq_settings(self) -> Dict[str, Any]:
|
|
68
68
|
"""
|
|
69
|
-
Generate
|
|
69
|
+
Generate ReArq-specific settings.
|
|
70
70
|
|
|
71
71
|
Returns:
|
|
72
|
-
Dictionary with
|
|
72
|
+
Dictionary with ReArq configuration
|
|
73
73
|
"""
|
|
74
74
|
from django_cfg.models.tasks import TaskConfig
|
|
75
|
-
from django_cfg.modules.django_tasks import generate_dramatiq_settings_from_config
|
|
76
75
|
|
|
77
76
|
# Auto-initialize TaskConfig if needed
|
|
78
77
|
task_config = TaskConfig.auto_initialize_if_needed()
|
|
79
78
|
if task_config is None:
|
|
80
79
|
return {}
|
|
81
80
|
|
|
82
|
-
# Generate
|
|
83
|
-
|
|
84
|
-
if not dramatiq_settings:
|
|
85
|
-
return {}
|
|
86
|
-
|
|
87
|
-
logger.info("✅ Dramatiq enabled (tasks/knowbase/agents required)")
|
|
81
|
+
# Generate settings via standard method
|
|
82
|
+
settings = task_config.to_django_settings()
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
logger.info("✅ ReArq tasks enabled")
|
|
85
|
+
return settings
|
|
90
86
|
|
|
91
87
|
|
|
92
88
|
__all__ = ["TasksSettingsGenerator"]
|
|
@@ -64,7 +64,8 @@ class CryptoFieldsSettingsGenerator:
|
|
|
64
64
|
return crypto_config.to_django_settings(
|
|
65
65
|
base_dir=self.config.base_dir,
|
|
66
66
|
is_production=self.config.is_production,
|
|
67
|
-
debug=self.config.debug
|
|
67
|
+
debug=self.config.debug,
|
|
68
|
+
project_version=self.config.project_version
|
|
68
69
|
)
|
|
69
70
|
|
|
70
71
|
|
|
@@ -429,7 +429,7 @@ class StartupDisplayManager(BaseDisplayManager):
|
|
|
429
429
|
task_table.add_row("Queue", "[yellow]default[/yellow]")
|
|
430
430
|
|
|
431
431
|
# Add worker command
|
|
432
|
-
task_table.add_row("Start Workers", "[bright_blue]poetry run python manage.py
|
|
432
|
+
task_table.add_row("Start Workers", "[bright_blue]poetry run python manage.py runrearq[/bright_blue]")
|
|
433
433
|
|
|
434
434
|
task_panel = self.create_full_width_panel(
|
|
435
435
|
task_table,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Admin API Mixin.
|
|
3
|
+
|
|
4
|
+
Common configuration for admin-only API endpoints.
|
|
5
|
+
"""
|
|
6
|
+
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
|
|
7
|
+
from rest_framework.permissions import IsAdminUser
|
|
8
|
+
from rest_framework_simplejwt.authentication import JWTAuthentication
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AdminAPIMixin:
|
|
12
|
+
"""
|
|
13
|
+
Mixin for admin-only API endpoints.
|
|
14
|
+
|
|
15
|
+
Provides:
|
|
16
|
+
- JWT, Session, and Basic authentication
|
|
17
|
+
- IsAdminUser permission requirement
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
class MyViewSet(AdminAPIMixin, viewsets.ModelViewSet):
|
|
21
|
+
queryset = MyModel.objects.all()
|
|
22
|
+
serializer_class = MySerializer
|
|
23
|
+
|
|
24
|
+
Authentication Methods:
|
|
25
|
+
1. JWT Token (Bearer): For frontend SPA authentication
|
|
26
|
+
2. Session: For Django admin integration
|
|
27
|
+
3. Basic Auth: For testing and scripts
|
|
28
|
+
|
|
29
|
+
All endpoints require admin user privileges.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
authentication_classes = [
|
|
33
|
+
JWTAuthentication, # JWT tokens (Bearer)
|
|
34
|
+
SessionAuthentication, # Django session (for admin)
|
|
35
|
+
BasicAuthentication, # HTTP Basic (for testing)
|
|
36
|
+
]
|
|
37
|
+
permission_classes = [IsAdminUser]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Client API Mixin.
|
|
3
|
+
|
|
4
|
+
Common configuration for client API endpoints (authenticated users).
|
|
5
|
+
"""
|
|
6
|
+
from rest_framework.authentication import SessionAuthentication
|
|
7
|
+
from rest_framework.permissions import IsAuthenticated
|
|
8
|
+
from rest_framework_simplejwt.authentication import JWTAuthentication
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ClientAPIMixin:
|
|
12
|
+
"""
|
|
13
|
+
Mixin for client API endpoints (authenticated regular users).
|
|
14
|
+
|
|
15
|
+
Provides:
|
|
16
|
+
- JWT and Session authentication
|
|
17
|
+
- IsAuthenticated permission requirement
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
class MyViewSet(ClientAPIMixin, viewsets.ModelViewSet):
|
|
21
|
+
queryset = MyModel.objects.all()
|
|
22
|
+
serializer_class = MySerializer
|
|
23
|
+
|
|
24
|
+
def get_queryset(self):
|
|
25
|
+
# Filter by current user
|
|
26
|
+
return super().get_queryset().filter(user=self.request.user)
|
|
27
|
+
|
|
28
|
+
Authentication Methods:
|
|
29
|
+
1. JWT Token (Bearer): For frontend SPA authentication
|
|
30
|
+
2. Session: For web browser sessions
|
|
31
|
+
|
|
32
|
+
All endpoints require authenticated user (not necessarily admin).
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
authentication_classes = [
|
|
36
|
+
JWTAuthentication, # JWT tokens (Bearer)
|
|
37
|
+
SessionAuthentication, # Django session
|
|
38
|
+
]
|
|
39
|
+
permission_classes = [IsAuthenticated]
|
|
@@ -164,14 +164,8 @@ class ConstanceConfig(BaseModel, BaseCfgAutoModule):
|
|
|
164
164
|
app_fields = []
|
|
165
165
|
config = self.get_config()
|
|
166
166
|
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
-
try:
|
|
170
|
-
from django_cfg.modules.django_tasks import extend_constance_config_with_tasks
|
|
171
|
-
tasks_fields = extend_constance_config_with_tasks()
|
|
172
|
-
app_fields.extend(tasks_fields)
|
|
173
|
-
except (ImportError, Exception):
|
|
174
|
-
pass
|
|
167
|
+
# Note: Tasks constance fields removed - ReArq doesn't use dynamic config
|
|
168
|
+
# Task configuration is managed via TaskConfig model
|
|
175
169
|
|
|
176
170
|
# Get fields from knowbase app (only if enabled)
|
|
177
171
|
if config and config.enable_knowbase:
|
|
@@ -68,7 +68,7 @@ class CryptoFieldsConfig(BaseModel):
|
|
|
68
68
|
)
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
def to_django_settings(self, base_dir: Path, is_production: bool, debug: bool) -> dict:
|
|
71
|
+
def to_django_settings(self, base_dir: Path, is_production: bool, debug: bool, project_version: str = "1.0.0") -> dict:
|
|
72
72
|
"""
|
|
73
73
|
Convert to Django settings dictionary with environment-aware defaults.
|
|
74
74
|
|
|
@@ -76,6 +76,7 @@ class CryptoFieldsConfig(BaseModel):
|
|
|
76
76
|
base_dir: Django project BASE_DIR
|
|
77
77
|
is_production: Whether running in production mode
|
|
78
78
|
debug: Whether debug mode is enabled
|
|
79
|
+
project_version: Project version to use for REVISION (default: "1.0.0")
|
|
79
80
|
|
|
80
81
|
Returns:
|
|
81
82
|
Dictionary of django-crypto-fields settings
|
|
@@ -111,53 +112,17 @@ class CryptoFieldsConfig(BaseModel):
|
|
|
111
112
|
"AUTO_CREATE_KEYS": auto_create_keys,
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
#
|
|
115
|
-
#
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
version_file = base_dir / "VERSION"
|
|
126
|
-
if not version_file.exists():
|
|
127
|
-
try:
|
|
128
|
-
# Try to get version from pyproject.toml or package metadata
|
|
129
|
-
version_to_write = "1.0.0" # Default fallback
|
|
130
|
-
|
|
131
|
-
# Try pyproject.toml first
|
|
132
|
-
pyproject_file = base_dir / "pyproject.toml"
|
|
133
|
-
if pyproject_file.exists():
|
|
134
|
-
try:
|
|
135
|
-
import tomllib
|
|
136
|
-
except ImportError:
|
|
137
|
-
# Python < 3.11
|
|
138
|
-
try:
|
|
139
|
-
import tomli as tomllib # type: ignore
|
|
140
|
-
except ImportError:
|
|
141
|
-
tomllib = None # type: ignore
|
|
142
|
-
|
|
143
|
-
if tomllib:
|
|
144
|
-
try:
|
|
145
|
-
with open(pyproject_file, "rb") as f:
|
|
146
|
-
pyproject_data = tomllib.load(f)
|
|
147
|
-
version_to_write = pyproject_data.get("project", {}).get("version", version_to_write)
|
|
148
|
-
except Exception:
|
|
149
|
-
pass # Use default version
|
|
150
|
-
|
|
151
|
-
# Write VERSION file
|
|
152
|
-
version_file.write_text(version_to_write + "\n")
|
|
153
|
-
|
|
154
|
-
import logging
|
|
155
|
-
logger = logging.getLogger(__name__)
|
|
156
|
-
logger.info(f"Created VERSION file at {version_file} with version {version_to_write}")
|
|
157
|
-
except Exception as e:
|
|
158
|
-
import logging
|
|
159
|
-
logger = logging.getLogger(__name__)
|
|
160
|
-
logger.warning(f"Could not create VERSION file: {e}")
|
|
115
|
+
# Fix django-revision (required by django-audit-fields dependency)
|
|
116
|
+
# Disable all automatic version detection and use project version directly
|
|
117
|
+
# This prevents "A distribution name is required" error when package metadata is not available
|
|
118
|
+
settings.update({
|
|
119
|
+
"REVISION": project_version,
|
|
120
|
+
"APP_NAME": "", # Empty to prevent package metadata lookup
|
|
121
|
+
"DJANGO_REVISION_IGNORE_METADATA": True, # Don't use importlib.metadata.version()
|
|
122
|
+
"DJANGO_REVISION_IGNORE_TOML_FILE": True, # Don't read pyproject.toml
|
|
123
|
+
"DJANGO_REVISION_IGNORE_VERSION_FILE": True, # Don't read VERSION file
|
|
124
|
+
"DJANGO_REVISION_IGNORE_WORKING_DIR": True, # Don't use git
|
|
125
|
+
})
|
|
161
126
|
|
|
162
127
|
return settings
|
|
163
128
|
|
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
Task processing configuration models for Django-CFG.
|
|
3
3
|
|
|
4
4
|
This module provides type-safe Pydantic models for configuring background task
|
|
5
|
-
processing with
|
|
5
|
+
processing with ReArq, including worker management, queue configuration,
|
|
6
6
|
and monitoring settings.
|
|
7
7
|
|
|
8
8
|
Architecture:
|
|
9
9
|
config.py - Main TaskConfig and enums
|
|
10
|
-
backends.py -
|
|
10
|
+
backends.py - RearqConfig
|
|
11
11
|
utils.py - Utility functions
|
|
12
12
|
|
|
13
13
|
Example:
|
|
14
14
|
```python
|
|
15
|
-
from django_cfg.models.tasks import TaskConfig,
|
|
15
|
+
from django_cfg.models.tasks import TaskConfig, RearqConfig
|
|
16
16
|
|
|
17
17
|
# Basic configuration
|
|
18
18
|
tasks = TaskConfig(
|
|
19
19
|
enabled=True,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
queues=["default", "high", "low"],
|
|
20
|
+
rearq=RearqConfig(
|
|
21
|
+
redis_url="redis://localhost:6379/0",
|
|
22
|
+
max_jobs=10,
|
|
24
23
|
)
|
|
25
24
|
)
|
|
26
25
|
|
|
@@ -30,7 +29,7 @@ Example:
|
|
|
30
29
|
```
|
|
31
30
|
"""
|
|
32
31
|
|
|
33
|
-
from .backends import
|
|
32
|
+
from .backends import RearqConfig
|
|
34
33
|
from .config import QueuePriority, TaskBackend, TaskConfig
|
|
35
34
|
from .utils import get_default_task_config, get_smart_queues, validate_task_config
|
|
36
35
|
|
|
@@ -41,8 +40,7 @@ __all__ = [
|
|
|
41
40
|
"QueuePriority",
|
|
42
41
|
|
|
43
42
|
# Backend configurations
|
|
44
|
-
"
|
|
45
|
-
"WorkerConfig",
|
|
43
|
+
"RearqConfig",
|
|
46
44
|
|
|
47
45
|
# Utility functions
|
|
48
46
|
"get_default_task_config",
|