settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # Copyright © 2023 Ingram Micro Inc. All rights reserved.
  2. from pathlib import Path
  3. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  4. BASE_DIR = Path(__file__).resolve().parent.parent
  5. # Quick-start development settings - unsuitable for production
  6. # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
  7. # SECURITY WARNING: keep the secret key used in production secret!
  8. SECRET_KEY = 'django-insecure-4acv=f5e@@hsxe42)c2ldt&!cwej5@&-h+qt_o21+&&6ynr7_a'
  9. # SECURITY WARNING: don't run with debug turned on in production!
  10. DEBUG = True
  11. ALLOWED_HOSTS = ['*']
  12. AUTH_USER_MODEL = 'app.User'
  13. # Application definition
  14. INSTALLED_APPS = [
  15. 'django.contrib.admin',
  16. 'django.contrib.auth',
  17. 'django.contrib.contenttypes',
  18. 'django.contrib.sessions',
  19. 'django.contrib.messages',
  20. 'django.contrib.staticfiles',
  21. 'dj_cqrs',
  22. 'app',
  23. ]
  24. MIDDLEWARE = [
  25. 'django.middleware.security.SecurityMiddleware',
  26. 'django.contrib.sessions.middleware.SessionMiddleware',
  27. 'django.middleware.common.CommonMiddleware',
  28. 'django.middleware.csrf.CsrfViewMiddleware',
  29. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  30. 'django.contrib.messages.middleware.MessageMiddleware',
  31. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  32. ]
  33. ROOT_URLCONF = 'app.urls'
  34. TEMPLATES = [
  35. {
  36. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  37. 'DIRS': ['templates'],
  38. 'APP_DIRS': True,
  39. 'OPTIONS': {
  40. 'context_processors': [
  41. 'django.template.context_processors.debug',
  42. 'django.template.context_processors.request',
  43. 'django.contrib.auth.context_processors.auth',
  44. 'django.contrib.messages.context_processors.messages',
  45. ],
  46. },
  47. },
  48. ]
  49. WSGI_APPLICATION = 'app.wsgi.application'
  50. # Database
  51. # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  52. DATABASES = {
  53. 'default': {
  54. 'ENGINE': 'django.db.backends.mysql',
  55. 'NAME': 'replica_service',
  56. 'USER': 'replica_service',
  57. 'PASSWORD': 'password',
  58. 'HOST': 'db_mysql',
  59. 'PORT': '3306',
  60. },
  61. }
  62. CACHES = {
  63. 'default': {
  64. 'BACKEND': 'django_redis.cache.RedisCache',
  65. 'LOCATION': 'redis://redis:6379/0',
  66. 'OPTIONS': {
  67. 'CLIENT_CLASS': 'django_redis.client.DefaultClient',
  68. },
  69. },
  70. }
  71. # Password validation
  72. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  73. AUTH_PASSWORD_VALIDATORS = [
  74. {
  75. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  76. },
  77. {
  78. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  79. },
  80. {
  81. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  82. },
  83. {
  84. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  85. },
  86. ]
  87. # Internationalization
  88. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  89. LANGUAGE_CODE = 'en-us'
  90. TIME_ZONE = 'UTC'
  91. USE_I18N = True
  92. USE_L10N = True
  93. USE_TZ = True
  94. # Static files (CSS, JavaScript, Images)
  95. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  96. STATIC_URL = '/static/'
  97. # Default primary key field type
  98. # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
  99. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  100. CQRS = {
  101. 'transport': 'dj_cqrs.transport.rabbit_mq.RabbitMQTransport',
  102. 'queue': 'blog_replica',
  103. 'host': 'rabbitmq',
  104. 'port': '5672',
  105. 'user': 'rabbitmq',
  106. 'password': 'password',
  107. }