django-cfg 1.4.10__py3-none-any.whl → 1.4.11__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_cfg/apps/agents/management/commands/create_agent.py +1 -1
- django_cfg/apps/agents/management/commands/orchestrator_status.py +3 -3
- django_cfg/apps/newsletter/serializers.py +40 -3
- django_cfg/apps/newsletter/views/campaigns.py +12 -3
- django_cfg/apps/newsletter/views/emails.py +14 -3
- django_cfg/apps/newsletter/views/subscriptions.py +12 -2
- django_cfg/apps/payments/views/api/currencies.py +49 -6
- django_cfg/apps/payments/views/api/webhooks.py +72 -7
- django_cfg/apps/payments/views/overview/serializers.py +34 -1
- django_cfg/apps/payments/views/overview/views.py +2 -1
- django_cfg/apps/payments/views/serializers/payments.py +6 -6
- django_cfg/apps/urls.py +106 -45
- django_cfg/core/base/config_model.py +2 -2
- django_cfg/core/constants.py +1 -1
- django_cfg/core/generation/integration_generators/__init__.py +1 -1
- django_cfg/core/generation/integration_generators/api.py +72 -49
- django_cfg/core/integration/display/startup.py +30 -22
- django_cfg/core/integration/url_integration.py +15 -16
- django_cfg/dashboard/sections/documentation.py +391 -0
- django_cfg/management/commands/check_endpoints.py +11 -160
- django_cfg/management/commands/check_settings.py +13 -348
- django_cfg/management/commands/clear_constance.py +13 -201
- django_cfg/management/commands/create_token.py +13 -321
- django_cfg/management/commands/generate_clients.py +23 -0
- django_cfg/management/commands/list_urls.py +13 -306
- django_cfg/management/commands/migrate_all.py +13 -126
- django_cfg/management/commands/migrator.py +13 -396
- django_cfg/management/commands/rundramatiq.py +15 -247
- django_cfg/management/commands/rundramatiq_simulator.py +12 -429
- django_cfg/management/commands/runserver_ngrok.py +15 -160
- django_cfg/management/commands/script.py +12 -488
- django_cfg/management/commands/show_config.py +12 -215
- django_cfg/management/commands/show_urls.py +12 -342
- django_cfg/management/commands/superuser.py +15 -295
- django_cfg/management/commands/task_clear.py +14 -217
- django_cfg/management/commands/task_status.py +13 -248
- django_cfg/management/commands/test_email.py +15 -86
- django_cfg/management/commands/test_telegram.py +14 -61
- django_cfg/management/commands/test_twilio.py +15 -105
- django_cfg/management/commands/tree.py +13 -383
- django_cfg/management/commands/validate_openapi.py +10 -0
- django_cfg/middleware/README.md +1 -1
- django_cfg/middleware/user_activity.py +3 -3
- django_cfg/models/__init__.py +2 -2
- django_cfg/models/api/drf/spectacular.py +6 -6
- django_cfg/models/django/__init__.py +2 -2
- django_cfg/models/django/openapi.py +238 -0
- django_cfg/modules/django_admin/management/__init__.py +0 -0
- django_cfg/modules/django_admin/management/commands/__init__.py +0 -0
- django_cfg/modules/django_admin/management/commands/check_endpoints.py +169 -0
- django_cfg/modules/django_admin/management/commands/check_settings.py +355 -0
- django_cfg/modules/django_admin/management/commands/clear_constance.py +208 -0
- django_cfg/modules/django_admin/management/commands/create_token.py +328 -0
- django_cfg/modules/django_admin/management/commands/list_urls.py +313 -0
- django_cfg/modules/django_admin/management/commands/migrate_all.py +133 -0
- django_cfg/modules/django_admin/management/commands/migrator.py +403 -0
- django_cfg/modules/django_admin/management/commands/script.py +496 -0
- django_cfg/modules/django_admin/management/commands/show_config.py +225 -0
- django_cfg/modules/django_admin/management/commands/show_urls.py +361 -0
- django_cfg/modules/django_admin/management/commands/superuser.py +302 -0
- django_cfg/modules/django_admin/management/commands/tree.py +390 -0
- django_cfg/modules/django_client/__init__.py +20 -0
- django_cfg/modules/django_client/apps.py +35 -0
- django_cfg/modules/django_client/core/__init__.py +56 -0
- django_cfg/modules/django_client/core/archive/__init__.py +11 -0
- django_cfg/modules/django_client/core/archive/manager.py +134 -0
- django_cfg/modules/django_client/core/cli/__init__.py +12 -0
- django_cfg/modules/django_client/core/cli/main.py +235 -0
- django_cfg/modules/django_client/core/config/__init__.py +18 -0
- django_cfg/modules/django_client/core/config/config.py +188 -0
- django_cfg/modules/django_client/core/config/group.py +101 -0
- django_cfg/modules/django_client/core/config/service.py +209 -0
- django_cfg/modules/django_client/core/generator/__init__.py +115 -0
- django_cfg/modules/django_client/core/generator/base.py +767 -0
- django_cfg/modules/django_client/core/generator/python.py +751 -0
- django_cfg/modules/django_client/core/generator/templates/python/__init__.py.jinja +9 -0
- django_cfg/modules/django_client/core/generator/templates/python/api_wrapper.py.jinja +130 -0
- django_cfg/modules/django_client/core/generator/templates/python/app_init.py.jinja +6 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/app_client.py.jinja +18 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/flat_client.py.jinja +38 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/main_client.py.jinja +50 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/main_client_file.py.jinja +13 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/operation_method.py.jinja +7 -0
- django_cfg/modules/django_client/core/generator/templates/python/client/sub_client.py.jinja +11 -0
- django_cfg/modules/django_client/core/generator/templates/python/client_file.py.jinja +13 -0
- django_cfg/modules/django_client/core/generator/templates/python/main_init.py.jinja +50 -0
- django_cfg/modules/django_client/core/generator/templates/python/models/app_models.py.jinja +17 -0
- django_cfg/modules/django_client/core/generator/templates/python/models/enum_class.py.jinja +15 -0
- django_cfg/modules/django_client/core/generator/templates/python/models/enums.py.jinja +8 -0
- django_cfg/modules/django_client/core/generator/templates/python/models/models.py.jinja +17 -0
- django_cfg/modules/django_client/core/generator/templates/python/models/schema_class.py.jinja +19 -0
- django_cfg/modules/django_client/core/generator/templates/python/utils/logger.py.jinja +255 -0
- django_cfg/modules/django_client/core/generator/templates/python/utils/schema.py.jinja +12 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/app_index.ts.jinja +2 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/app_client.ts.jinja +18 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/client.ts.jinja +327 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/flat_client.ts.jinja +109 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/main_client_file.ts.jinja +9 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/operation.ts.jinja +61 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client/sub_client.ts.jinja +15 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/client_file.ts.jinja +9 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/index.ts.jinja +5 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/main_index.ts.jinja +206 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/models/app_models.ts.jinja +8 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/models/enums.ts.jinja +4 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/models/models.ts.jinja +8 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/utils/errors.ts.jinja +114 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/utils/http.ts.jinja +98 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/utils/logger.ts.jinja +251 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/utils/schema.ts.jinja +7 -0
- django_cfg/modules/django_client/core/generator/templates/typescript/utils/storage.ts.jinja +114 -0
- django_cfg/modules/django_client/core/generator/typescript.py +872 -0
- django_cfg/modules/django_client/core/groups/__init__.py +13 -0
- django_cfg/modules/django_client/core/groups/detector.py +178 -0
- django_cfg/modules/django_client/core/groups/manager.py +314 -0
- django_cfg/modules/django_client/core/ir/__init__.py +57 -0
- django_cfg/modules/django_client/core/ir/context.py +387 -0
- django_cfg/modules/django_client/core/ir/operation.py +518 -0
- django_cfg/modules/django_client/core/ir/schema.py +353 -0
- django_cfg/modules/django_client/core/parser/__init__.py +74 -0
- django_cfg/modules/django_client/core/parser/base.py +648 -0
- django_cfg/modules/django_client/core/parser/models/__init__.py +74 -0
- django_cfg/modules/django_client/core/parser/models/base.py +212 -0
- django_cfg/modules/django_client/core/parser/models/components.py +160 -0
- django_cfg/modules/django_client/core/parser/models/openapi.py +203 -0
- django_cfg/modules/django_client/core/parser/models/operation.py +207 -0
- django_cfg/modules/django_client/core/parser/models/schema.py +266 -0
- django_cfg/modules/django_client/core/parser/openapi30.py +56 -0
- django_cfg/modules/django_client/core/parser/openapi31.py +64 -0
- django_cfg/modules/django_client/core/validation/__init__.py +22 -0
- django_cfg/modules/django_client/core/validation/checker.py +134 -0
- django_cfg/modules/django_client/core/validation/fixer.py +216 -0
- django_cfg/modules/django_client/core/validation/reporter.py +480 -0
- django_cfg/modules/django_client/core/validation/rules/__init__.py +11 -0
- django_cfg/modules/django_client/core/validation/rules/base.py +96 -0
- django_cfg/modules/django_client/core/validation/rules/type_hints.py +288 -0
- django_cfg/modules/django_client/core/validation/safety.py +266 -0
- django_cfg/modules/django_client/management/__init__.py +3 -0
- django_cfg/modules/django_client/management/commands/__init__.py +3 -0
- django_cfg/modules/django_client/management/commands/generate_client.py +422 -0
- django_cfg/modules/django_client/management/commands/validate_openapi.py +343 -0
- django_cfg/modules/django_client/spectacular/__init__.py +9 -0
- django_cfg/modules/django_client/spectacular/enum_naming.py +192 -0
- django_cfg/modules/django_client/urls.py +72 -0
- django_cfg/modules/django_email/management/__init__.py +0 -0
- django_cfg/modules/django_email/management/commands/__init__.py +0 -0
- django_cfg/modules/django_email/management/commands/test_email.py +93 -0
- django_cfg/modules/django_logging/django_logger.py +6 -6
- django_cfg/modules/django_ngrok/management/__init__.py +0 -0
- django_cfg/modules/django_ngrok/management/commands/__init__.py +0 -0
- django_cfg/modules/django_ngrok/management/commands/runserver_ngrok.py +167 -0
- django_cfg/modules/django_tasks/management/__init__.py +0 -0
- django_cfg/modules/django_tasks/management/commands/__init__.py +0 -0
- django_cfg/modules/django_tasks/management/commands/rundramatiq.py +254 -0
- django_cfg/modules/django_tasks/management/commands/rundramatiq_simulator.py +437 -0
- django_cfg/modules/django_tasks/management/commands/task_clear.py +226 -0
- django_cfg/modules/django_tasks/management/commands/task_status.py +257 -0
- django_cfg/modules/django_telegram/management/__init__.py +0 -0
- django_cfg/modules/django_telegram/management/commands/__init__.py +0 -0
- django_cfg/modules/django_telegram/management/commands/test_telegram.py +68 -0
- django_cfg/modules/django_twilio/management/__init__.py +0 -0
- django_cfg/modules/django_twilio/management/commands/__init__.py +0 -0
- django_cfg/modules/django_twilio/management/commands/test_twilio.py +112 -0
- django_cfg/modules/django_unfold/callbacks/main.py +16 -5
- django_cfg/modules/django_unfold/callbacks/revolution.py +41 -36
- django_cfg/pyproject.toml +2 -6
- django_cfg/registry/third_party.py +5 -7
- django_cfg/routing/callbacks.py +1 -1
- django_cfg/static/admin/css/prose-unfold.css +666 -0
- django_cfg/templates/admin/index.html +8 -0
- django_cfg/templates/admin/index_new.html +13 -0
- django_cfg/templates/admin/layouts/dashboard_with_tabs.html +15 -3
- django_cfg/templates/admin/sections/documentation_section.html +172 -0
- django_cfg/templates/admin/snippets/tabs/documentation_tab.html +231 -0
- {django_cfg-1.4.10.dist-info → django_cfg-1.4.11.dist-info}/METADATA +2 -2
- {django_cfg-1.4.10.dist-info → django_cfg-1.4.11.dist-info}/RECORD +180 -59
- django_cfg/management/commands/generate.py +0 -107
- /django_cfg/models/django/{revolution.py → revolution_legacy.py} +0 -0
- {django_cfg-1.4.10.dist-info → django_cfg-1.4.11.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.10.dist-info → django_cfg-1.4.11.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.10.dist-info → django_cfg-1.4.11.dist-info}/licenses/LICENSE +0 -0
@@ -1,254 +1,22 @@
|
|
1
1
|
"""
|
2
|
-
Django
|
2
|
+
Django-CFG wrapper for rundramatiq command.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
"""
|
7
|
-
|
8
|
-
import argparse
|
9
|
-
import importlib
|
10
|
-
import multiprocessing
|
11
|
-
import os
|
12
|
-
import sys
|
13
|
-
|
14
|
-
from django.apps import apps
|
15
|
-
from django.conf import settings
|
16
|
-
from django.core.management.base import BaseCommand
|
17
|
-
from django.utils.module_loading import module_has_submodule
|
18
|
-
from django_cfg.modules.django_logging import get_logger
|
19
|
-
from django_cfg.modules.django_tasks import get_task_service
|
20
|
-
|
21
|
-
|
22
|
-
# Default values
|
23
|
-
NPROCS = multiprocessing.cpu_count()
|
24
|
-
NTHREADS = 8
|
4
|
+
This is a simple alias for django_tasks.management.commands.rundramatiq.
|
5
|
+
All logic is in django_tasks module.
|
25
6
|
|
7
|
+
Usage:
|
8
|
+
python manage.py rundramatiq
|
9
|
+
python manage.py rundramatiq --processes 4 --threads 8
|
10
|
+
python manage.py rundramatiq --queues default high_priority
|
11
|
+
"""
|
26
12
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
class Command(BaseCommand):
|
31
|
-
# Web execution metadata
|
32
|
-
web_executable = False
|
33
|
-
requires_input = False
|
34
|
-
is_destructive = False
|
35
|
-
|
36
|
-
help = "Run Dramatiq workers with Django-CFG configuration."
|
37
|
-
|
38
|
-
def add_arguments(self, parser):
|
39
|
-
parser.formatter_class = argparse.ArgumentDefaultsHelpFormatter
|
40
|
-
|
41
|
-
parser.add_argument(
|
42
|
-
"--processes", "-p",
|
43
|
-
default=NPROCS,
|
44
|
-
type=int,
|
45
|
-
help="The number of processes to run",
|
46
|
-
)
|
47
|
-
parser.add_argument(
|
48
|
-
"--threads", "-t",
|
49
|
-
default=NTHREADS,
|
50
|
-
type=int,
|
51
|
-
help="The number of threads per process to use",
|
52
|
-
)
|
53
|
-
parser.add_argument(
|
54
|
-
"--queues", "-Q",
|
55
|
-
nargs="*",
|
56
|
-
type=str,
|
57
|
-
help="Listen to a subset of queues, or all when empty",
|
58
|
-
)
|
59
|
-
parser.add_argument(
|
60
|
-
"--watch",
|
61
|
-
dest="watch_dir",
|
62
|
-
help="Reload workers when changes are detected in the given directory",
|
63
|
-
)
|
64
|
-
parser.add_argument(
|
65
|
-
"--pid-file",
|
66
|
-
type=str,
|
67
|
-
help="Write the PID of the master process to this file",
|
68
|
-
)
|
69
|
-
parser.add_argument(
|
70
|
-
"--log-file",
|
71
|
-
type=str,
|
72
|
-
help="Write all logs to a file, or stderr when empty",
|
73
|
-
)
|
74
|
-
parser.add_argument(
|
75
|
-
"--worker-shutdown-timeout",
|
76
|
-
type=int,
|
77
|
-
default=600000,
|
78
|
-
help="Timeout for worker shutdown, in milliseconds"
|
79
|
-
)
|
80
|
-
parser.add_argument(
|
81
|
-
"--dry-run",
|
82
|
-
action="store_true",
|
83
|
-
help="Show configuration without starting workers",
|
84
|
-
)
|
13
|
+
from django_cfg.modules.django_tasks.management.commands.rundramatiq import Command as DramatiqCommand
|
85
14
|
|
86
|
-
def handle(self, watch_dir, processes, threads, verbosity, queues,
|
87
|
-
pid_file, log_file, worker_shutdown_timeout, dry_run, **options):
|
88
|
-
logger.info("Starting rundramatiq command")
|
89
|
-
|
90
|
-
# Get task service and validate
|
91
|
-
task_service = get_task_service()
|
92
|
-
if not task_service.is_enabled():
|
93
|
-
self.stdout.write(
|
94
|
-
self.style.ERROR("Task system is not enabled in Django-CFG configuration")
|
95
|
-
)
|
96
|
-
return
|
97
|
-
|
98
|
-
# Discover task modules
|
99
|
-
tasks_modules = self._discover_tasks_modules()
|
100
|
-
|
101
|
-
# Show configuration info
|
102
|
-
self.stdout.write(self.style.SUCCESS("Dramatiq Worker Configuration:"))
|
103
|
-
self.stdout.write(f"Processes: {processes}")
|
104
|
-
self.stdout.write(f"Threads: {threads}")
|
105
|
-
if queues:
|
106
|
-
self.stdout.write(f"Queues: {', '.join(queues)}")
|
107
|
-
else:
|
108
|
-
self.stdout.write("Queues: all")
|
109
|
-
|
110
|
-
self.stdout.write(f"\nDiscovered task modules:")
|
111
|
-
for module in tasks_modules:
|
112
|
-
self.stdout.write(f" - {module}")
|
113
|
-
|
114
|
-
# If dry run, show command and exit
|
115
|
-
if dry_run:
|
116
|
-
executable_name = "dramatiq"
|
117
|
-
|
118
|
-
process_args = [
|
119
|
-
executable_name,
|
120
|
-
"django_cfg.modules.django_tasks.dramatiq_setup", # Broker module
|
121
|
-
"--processes", str(processes),
|
122
|
-
"--threads", str(threads),
|
123
|
-
"--worker-shutdown-timeout", str(worker_shutdown_timeout),
|
124
|
-
]
|
125
|
-
|
126
|
-
if watch_dir:
|
127
|
-
process_args.extend(["--watch", watch_dir])
|
128
|
-
|
129
|
-
verbosity_args = ["-v"] * (verbosity - 1)
|
130
|
-
process_args.extend(verbosity_args)
|
131
|
-
|
132
|
-
if queues:
|
133
|
-
process_args.extend(["--queues"] + queues)
|
134
|
-
|
135
|
-
if pid_file:
|
136
|
-
process_args.extend(["--pid-file", pid_file])
|
137
|
-
|
138
|
-
if log_file:
|
139
|
-
process_args.extend(["--log-file", log_file])
|
140
|
-
|
141
|
-
# Add task modules (broker module is already first in tasks_modules)
|
142
|
-
process_args.extend(tasks_modules)
|
143
|
-
|
144
|
-
self.stdout.write(f"\nCommand that would be executed:")
|
145
|
-
self.stdout.write(f' {" ".join(process_args)}')
|
146
|
-
return
|
147
|
-
|
148
|
-
# Show startup info
|
149
|
-
self.stdout.write(self.style.SUCCESS("\nStarting Dramatiq workers..."))
|
150
|
-
|
151
|
-
# Build dramatiq command
|
152
|
-
executable_name = "dramatiq"
|
153
|
-
executable_path = self._resolve_executable(executable_name)
|
154
|
-
|
155
|
-
# Build process arguments exactly like django_dramatiq
|
156
|
-
process_args = [
|
157
|
-
executable_name,
|
158
|
-
"django_cfg.modules.django_tasks.dramatiq_setup", # Broker module
|
159
|
-
"--processes", str(processes),
|
160
|
-
"--threads", str(threads),
|
161
|
-
"--worker-shutdown-timeout", str(worker_shutdown_timeout),
|
162
|
-
]
|
163
|
-
|
164
|
-
# Add watch directory if specified
|
165
|
-
if watch_dir:
|
166
|
-
process_args.extend(["--watch", watch_dir])
|
167
|
-
|
168
|
-
# Add verbosity
|
169
|
-
verbosity_args = ["-v"] * (verbosity - 1)
|
170
|
-
process_args.extend(verbosity_args)
|
171
|
-
|
172
|
-
# Add queues if specified
|
173
|
-
if queues:
|
174
|
-
process_args.extend(["--queues"] + queues)
|
175
|
-
|
176
|
-
# Add PID file if specified
|
177
|
-
if pid_file:
|
178
|
-
process_args.extend(["--pid-file", pid_file])
|
179
|
-
|
180
|
-
# Add log file if specified
|
181
|
-
if log_file:
|
182
|
-
process_args.extend(["--log-file", log_file])
|
183
|
-
|
184
|
-
# Add task modules (broker module is already first in tasks_modules)
|
185
|
-
process_args.extend(tasks_modules)
|
186
|
-
|
187
|
-
self.stdout.write(f'Running dramatiq: "{" ".join(process_args)}"\n')
|
188
|
-
|
189
|
-
# Ensure DJANGO_SETTINGS_MODULE is set for worker processes
|
190
|
-
if not os.environ.get('DJANGO_SETTINGS_MODULE'):
|
191
|
-
if hasattr(settings, 'SETTINGS_MODULE'):
|
192
|
-
os.environ['DJANGO_SETTINGS_MODULE'] = settings.SETTINGS_MODULE
|
193
|
-
else:
|
194
|
-
# Try to detect from manage.py or current settings
|
195
|
-
import django
|
196
|
-
from django.conf import settings as django_settings
|
197
|
-
if hasattr(django_settings, '_wrapped') and hasattr(django_settings._wrapped, '__module__'):
|
198
|
-
module_name = django_settings._wrapped.__module__
|
199
|
-
os.environ['DJANGO_SETTINGS_MODULE'] = module_name
|
200
|
-
else:
|
201
|
-
self.stdout.write(
|
202
|
-
self.style.WARNING("Could not detect DJANGO_SETTINGS_MODULE")
|
203
|
-
)
|
204
|
-
|
205
|
-
# Use os.execvp like django_dramatiq to preserve environment
|
206
|
-
if sys.platform == "win32":
|
207
|
-
import subprocess
|
208
|
-
command = [executable_path] + process_args[1:]
|
209
|
-
sys.exit(subprocess.run(command))
|
210
|
-
|
211
|
-
os.execvp(executable_path, process_args)
|
212
15
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
tasks_modules = ["django_cfg.modules.django_tasks.dramatiq_setup"]
|
217
|
-
|
218
|
-
# Get task service for configuration
|
219
|
-
task_service = get_task_service()
|
220
|
-
|
221
|
-
# Try to get task modules from Django-CFG config
|
222
|
-
if task_service.config and task_service.config.auto_discover_tasks:
|
223
|
-
discovered = task_service.discover_tasks()
|
224
|
-
for module_name in discovered:
|
225
|
-
self.stdout.write(f"Discovered tasks module: '{module_name}'")
|
226
|
-
tasks_modules.append(module_name)
|
227
|
-
|
228
|
-
# Fallback: use django_dramatiq discovery logic
|
229
|
-
if len(tasks_modules) == 1: # Only broker module found
|
230
|
-
task_module_names = getattr(settings, "DRAMATIQ_AUTODISCOVER_MODULES", ("tasks",))
|
231
|
-
|
232
|
-
for app_config in apps.get_app_configs():
|
233
|
-
for task_module in task_module_names:
|
234
|
-
if module_has_submodule(app_config.module, task_module):
|
235
|
-
module_name = f"{app_config.name}.{task_module}"
|
236
|
-
try:
|
237
|
-
importlib.import_module(module_name)
|
238
|
-
self.stdout.write(f"Discovered tasks module: '{module_name}'")
|
239
|
-
tasks_modules.append(module_name)
|
240
|
-
except ImportError:
|
241
|
-
# Module exists but has import errors, skip it
|
242
|
-
pass
|
243
|
-
|
244
|
-
return tasks_modules
|
16
|
+
class Command(DramatiqCommand):
|
17
|
+
"""
|
18
|
+
Alias for rundramatiq command.
|
245
19
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
if bin_dir:
|
250
|
-
for d in [bin_dir, os.path.join(bin_dir, "Scripts")]:
|
251
|
-
exec_path = os.path.join(d, exec_name)
|
252
|
-
if os.path.isfile(exec_path):
|
253
|
-
return exec_path
|
254
|
-
return exec_name
|
20
|
+
Simply inherits from DramatiqCommand without any changes.
|
21
|
+
"""
|
22
|
+
pass
|