oncall-engine/engine/settings/prod_without_db.py
Michael Derynck 56c0c023ad
Test celery tasks have queue assignment (#2922)
# What this PR does

- Add a test to ensure celery tasks are assigned to a queue
- Move CELERY_TASK_ROUTES out of settings into its own file for easier
reuse and reference.

## Which issue(s) this PR fixes

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-31 18:42:08 +00:00

59 lines
1.4 KiB
Python

import os
from . import celery_task_routes
from .base import * # noqa: F401, F403
try:
import uwsgi
from prometheus_client import multiprocess
def on_uwsgi_worker_exit():
multiprocess.mark_process_dead(os.getpid())
uwsgi.atexit = on_uwsgi_worker_exit
except ModuleNotFoundError:
# Only works under uwsgi web server environment
pass
SLACK_SIGNING_SECRET = os.environ.get("SLACK_SIGNING_SECRET")
SLACK_SIGNING_SECRET_LIVE = os.environ.get("SLACK_SIGNING_SECRET_LIVE", "")
STATICFILES_DIRS = [
"/etc/app/static",
]
STATIC_ROOT = "./collected_static/"
DEBUG = False
SECURE_SSL_REDIRECT = True
SECURE_REDIRECT_EXEMPT = [
"^health/",
"^health",
"^ready/",
"^ready",
"^startupprobe/",
"^startupprobe",
"^ready_health_check/",
"^ready_health_check",
"^live_health_check/",
"^live_health_check",
"^django-prometheus/metrics",
"^django-prometheus/metrics/",
]
SECURE_HSTS_SECONDS = 360000
CELERY_TASK_ROUTES = celery_task_routes.CELERY_TASK_ROUTES
REST_FRAMEWORK = {
"DEFAULT_PARSER_CLASSES": (
"rest_framework.parsers.JSONParser",
"rest_framework.parsers.FormParser",
"rest_framework.parsers.MultiPartParser",
),
"DEFAULT_AUTHENTICATION_CLASSES": [],
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}