feat(src/djinit/templates):add conditional django_q and celery applications and configurationAdd django_q and celery to project settings when feature flags are enabled, and provide default configuration values for both. Extend requirements template with corresponding dependencies.
This commit is contained in:
2 files changed
+31
No files matched your search
@@ -29,6 +29,8 @@ THIRD_PARTY_APPS = [
|
||||
"django_tailwind_cli", # @IF use_tailwind
|
||||
"django_htmx", # @IF use_htmx
|
||||
"django_vite", # @IF use_vite | use_vue
|
||||
"django_q", # @IF use_django_q
|
||||
"celery", # @IF use_celery
|
||||
]
|
||||
|
||||
USER_DEFINED_APPS = [
|
||||
@@ -235,3 +237,30 @@ STATIC_URL = "/static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STATICFILES_DIRS = [BASE_DIR / "static"]
|
||||
# @ENDIF
|
||||
|
||||
# @IF use_django_q
|
||||
# Django-Q2 configuration
|
||||
Q_CLUSTER = {
|
||||
"name": "djinit_project",
|
||||
"workers": 4,
|
||||
"max_threads": 30,
|
||||
"timeout": 90,
|
||||
"retry": 120,
|
||||
"queue_limit": 50,
|
||||
"bulk": 10,
|
||||
"orm": "default",
|
||||
"cache": "default",
|
||||
}
|
||||
# @ENDIF
|
||||
|
||||
# @IF use_celery
|
||||
# Celery configuration
|
||||
CELERY_BROKER_URL = env("CELERY_BROKER_URL", default="redis://localhost:6379/0")
|
||||
CELERY_RESULT_BACKEND = env("CELERY_RESULT_BACKEND", default="redis://localhost:6379/0")
|
||||
CELERY_ACCEPT_CONTENT = ["json"]
|
||||
CELERY_TASK_SERIALIZER = "json"
|
||||
CELERY_RESULT_SERIALIZER = "json"
|
||||
CELERY_TIMEZONE = TIME_ZONE
|
||||
CELERY_TASK_TRACK_STARTED = True
|
||||
CELERY_TASK_TIME_LIMIT = 30 * 60
|
||||
# @ENDIF
|
||||
@@ -17,6 +17,8 @@ django-vite # @IF use_vue
|
||||
pytest # @IF use_pytest
|
||||
pytest-django # @IF use_pytest
|
||||
pytest-cov # @IF use_pytest
|
||||
django-q2 # @IF use_django_q
|
||||
celery # @IF use_celery
|
||||
# @IF database_type == 'mysql'
|
||||
mysqlclient
|
||||
# @ELSE
|
||||
|
||||
Reference in new issue
Block a user