You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
3.8 KiB
139 lines
3.8 KiB
# import sentry_sdk
|
|
|
|
from .base import *
|
|
from celery.schedules import crontab
|
|
|
|
DEBUG = False
|
|
|
|
#It is currently active
|
|
CORS_ALLOW_ALL_ORIGINS = True
|
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
|
|
|
|
CELERY_BROKER_URL = env("REDIS_URL")
|
|
CELERY_RESULT_BACKEND = env("REDIS_URL")
|
|
CELERY_ACCEPT_CONTENT = ['application/json']
|
|
CELERY_TASK_SERIALIZER = 'json'
|
|
CELERY_RESULT_SERIALIZER = 'json'
|
|
CELERY_TIMEZONE = 'Asia/Tehran'
|
|
CELERY_BROKER_TRANSPORT = 'redis'
|
|
|
|
# زمانبندی Celery Beat
|
|
|
|
CELERY_BEAT_SCHEDULE = {
|
|
'crawler_website_bonbast_rate_usd_every_half_hour': {
|
|
'task': 'apps.tasrif.tasks.crawler_website_bonbast_rate_usd',
|
|
'schedule': crontab(minute=0, hour='*/1'), # اجرای هر ساعت یکبار
|
|
},
|
|
}
|
|
|
|
# CORS_ALLOWED_ORIGINS = [
|
|
# 'https://aqila.nwhco.ir',
|
|
# 'http://aqila.nwhco.ir',
|
|
# 'https://aqila.com',
|
|
# 'https://pay.aqila.com',
|
|
# 'http://pay.aqila.com',
|
|
# 'https://qa.aqila.com',
|
|
# 'http://aqila.com',
|
|
# 'http://aqila.app',
|
|
# 'https://aqila.app',
|
|
# ]
|
|
|
|
CACHES = {
|
|
'default': {
|
|
"BACKEND": "django_redis.cache.RedisCache",
|
|
"LOCATION": env("REDIS_URL"),
|
|
"OPTIONS": {
|
|
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
|
}
|
|
},
|
|
'memory': {
|
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
'LOCATION': 'unique-snowflake',
|
|
'TIMEOUT': 5000,
|
|
},
|
|
}
|
|
|
|
# sentry_sdk.init(
|
|
# dsn="https://4d54a16a5ea997f6dd4859a4d34da230@us.sentry.io/4506682167525376",
|
|
# # Set traces_sample_rate to 1.0 to capture 100%
|
|
# # of transactions for performance monitoring.
|
|
# traces_sample_rate=1.0,
|
|
# # Set profiles_sample_rate to 1.0 to profile 100%
|
|
# # of sampled transactions.
|
|
# # We recommend adjusting this value in production.
|
|
# profiles_sample_rate=1.0,
|
|
# )
|
|
|
|
# REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] = [
|
|
# 'rest_framework.renderers.JSONRenderer',
|
|
# ]
|
|
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_PAGINATION_CLASS': 'utils.pagination.StandardResultsSetPagination',
|
|
'PAGE_SIZE': 16,
|
|
# 'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
# 'apps.account.auth_back.TokenAuthentication2',
|
|
# ],
|
|
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
|
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
'rest_framework.authentication.TokenAuthentication',
|
|
# 'rest_framework.authentication.SessionAuthentication',
|
|
],
|
|
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
|
'EXCEPTION_HANDLER': 'utils.exceptions.exception_handler',
|
|
'DEFAULT_RENDERER_CLASSES':[
|
|
'rest_framework.renderers.JSONRenderer',
|
|
]
|
|
}
|
|
|
|
|
|
LOGGING = {
|
|
"version": 1,
|
|
"disable_existing_loggers": False,
|
|
"filters": {
|
|
"require_debug_false": {
|
|
"()": "django.utils.log.RequireDebugFalse",
|
|
},
|
|
"require_debug_true": {
|
|
"()": "django.utils.log.RequireDebugTrue",
|
|
},
|
|
},
|
|
"formatters": {
|
|
"django.server": {
|
|
"()": "django.utils.log.ServerFormatter",
|
|
"format": "[{server_time}] {message}",
|
|
"style": "{",
|
|
}
|
|
},
|
|
"handlers": {
|
|
"console": {
|
|
"level": "INFO",
|
|
"class": "logging.StreamHandler",
|
|
},
|
|
"django.server": {
|
|
"level": "INFO",
|
|
"class": "logging.StreamHandler",
|
|
"formatter": "django.server",
|
|
},
|
|
"mail_admins": {
|
|
"level": "ERROR",
|
|
"filters": ["require_debug_false"],
|
|
"class": "django.utils.log.AdminEmailHandler",
|
|
},
|
|
},
|
|
"loggers": {
|
|
"django": {
|
|
"handlers": ["console", "mail_admins"],
|
|
"level": "INFO",
|
|
},
|
|
"django.server": {
|
|
"handlers": ["django.server"],
|
|
"level": "INFO",
|
|
"propagate": False,
|
|
},
|
|
},
|
|
}
|