replica_settings.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright © 2023 Ingram Micro Inc. All rights reserved.
  2. import os
  3. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  4. SECRET_KEY = '6^1@%4#qtc+bookwp4w5k-+nbo+clm!skzdhnyl@rf&06b5tl7'
  5. DEBUG = True
  6. ALLOWED_HOSTS = []
  7. # Application definition
  8. INSTALLED_APPS = [
  9. 'django.contrib.auth',
  10. 'django.contrib.contenttypes',
  11. 'django.contrib.sessions',
  12. 'django.contrib.messages',
  13. 'dj_cqrs',
  14. 'tests.dj_replica',
  15. ]
  16. MIDDLEWARE = [
  17. 'django.middleware.security.SecurityMiddleware',
  18. 'django.contrib.sessions.middleware.SessionMiddleware',
  19. 'django.middleware.common.CommonMiddleware',
  20. 'django.middleware.csrf.CsrfViewMiddleware',
  21. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  22. 'django.contrib.messages.middleware.MessageMiddleware',
  23. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  24. ]
  25. ROOT_URLCONF = 'tests.dj.urls'
  26. DATABASES = {
  27. 'default': {
  28. 'ENGINE': 'django.db.backends.postgresql',
  29. 'HOST': os.getenv('POSTGRES_HOST', 'postgres'),
  30. 'NAME': os.getenv('POSTGRES_DB', 'replica'),
  31. 'USER': os.getenv('POSTGRES_USER', 'user'),
  32. 'PASSWORD': os.getenv('POSTGRES_PASSWORD', 'pswd'),
  33. },
  34. }
  35. LANGUAGE_CODE = 'en-us'
  36. TIME_ZONE = 'UTC'
  37. USE_I18N = True
  38. USE_L10N = True
  39. USE_TZ = True
  40. CQRS = {
  41. 'transport': os.getenv('CQRS_REPLICA_TRANSPORT'),
  42. 'url': os.getenv('CQRS_BROKER_URL'),
  43. 'consumer_prefetch_count': 2,
  44. 'queue': 'replica',
  45. 'replica': {
  46. 'CQRS_MAX_RETRIES': 2,
  47. 'CQRS_RETRY_DELAY': 1,
  48. 'delay_queue_max_size': 50,
  49. 'dead_letter_queue': 'dead_letter_replica',
  50. 'dead_message_ttl': 5,
  51. 'CQRS_QUERY_TIMEOUT': 10000,
  52. 'CQRS_LOG_TIMED_OUT_QUERIES': 1,
  53. },
  54. }
  55. DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'