diff --git a/apps/utils/views.py b/apps/utils/views.py index c09df2a2..8becc9ea 100644 --- a/apps/utils/views.py +++ b/apps/utils/views.py @@ -70,22 +70,12 @@ class JWTGenericViewMixin: def _put_cookies_in_response(self, cookies: list, response: Response): """Update COOKIES in response from namedtuple""" for cookie in cookies: - # todo: remove config for develop - from os import environ - configuration = environ.get('SETTINGS_CONFIGURATION', None) - if configuration == 'development' or configuration == 'stage': - response.set_cookie(key=cookie.key, - value=cookie.value, - secure=cookie.secure, - httponly=cookie.http_only, - max_age=cookie.max_age, - domain='.id-east.ru') - else: - response.set_cookie(key=cookie.key, - value=cookie.value, - secure=cookie.secure, - httponly=cookie.http_only, - max_age=cookie.max_age, ) + response.set_cookie(key=cookie.key, + value=cookie.value, + secure=cookie.secure, + httponly=cookie.http_only, + max_age=cookie.max_age, + domain=settings.COOKIE_DOMAIN) return response def _get_tokens_from_cookies(self, request, cookies: dict = None): diff --git a/project/settings/base.py b/project/settings/base.py index ca4232ae..2c6f0cf0 100644 --- a/project/settings/base.py +++ b/project/settings/base.py @@ -521,3 +521,5 @@ NEWS_CHOSEN_TAGS = ['eat', 'drink', 'cook', 'style', 'international', 'event', ' INTERNATIONAL_COUNTRY_CODES = ['www', 'main', 'next'] THUMBNAIL_ENGINE = 'utils.thumbnail_engine.GMEngine' + +COOKIE_DOMAIN = None diff --git a/project/settings/development.py b/project/settings/development.py index 057438f5..f850aad7 100644 --- a/project/settings/development.py +++ b/project/settings/development.py @@ -71,3 +71,5 @@ INSTALLED_APPS.append('transfer.apps.TransferConfig') BROKER_URL = 'redis://localhost:6379/1' CELERY_RESULT_BACKEND = BROKER_URL CELERY_BROKER_URL = BROKER_URL + +COOKIE_DOMAIN = '.id-east.ru' diff --git a/project/settings/local.py b/project/settings/local.py index f88a72b1..7784be90 100644 --- a/project/settings/local.py +++ b/project/settings/local.py @@ -5,18 +5,15 @@ import sys ALLOWED_HOSTS = ['*', ] - SEND_SMS = False SMS_CODE_SHOW = True USE_CELERY = True - SCHEMA_URI = 'http' DEFAULT_SUBDOMAIN = 'www' SITE_DOMAIN_URI = 'testserver.com:8000' DOMAIN_URI = '0.0.0.0:8000' - # CELERY # RabbitMQ # BROKER_URL = 'amqp://rabbitmq:5672' @@ -25,20 +22,16 @@ BROKER_URL = 'redis://redis:6379/1' CELERY_RESULT_BACKEND = BROKER_URL CELERY_BROKER_URL = BROKER_URL - # MEDIA MEDIA_URL = f'{SCHEMA_URI}://{DOMAIN_URI}/{MEDIA_LOCATION}/' MEDIA_ROOT = os.path.join(PUBLIC_ROOT, MEDIA_LOCATION) - # SORL thumbnails THUMBNAIL_DEBUG = True - # ADDED TRANSFER APP INSTALLED_APPS.append('transfer.apps.TransferConfig') - # DATABASES DATABASES.update({ 'legacy': { @@ -88,7 +81,6 @@ LOGGING = { } } - # ELASTICSEARCH SETTINGS ELASTICSEARCH_DSL = { 'default': { @@ -102,8 +94,7 @@ ELASTICSEARCH_INDEX_NAMES = { 'search_indexes.documents.product': 'local_product', } - TESTING = sys.argv[1:2] == ['test'] if TESTING: ELASTICSEARCH_INDEX_NAMES = {} -ELASTICSEARCH_DSL_AUTOSYNC = False \ No newline at end of file +ELASTICSEARCH_DSL_AUTOSYNC = False diff --git a/project/settings/production.py b/project/settings/production.py index e745f3bc..997d6526 100644 --- a/project/settings/production.py +++ b/project/settings/production.py @@ -20,7 +20,6 @@ DEFAULT_SUBDOMAIN = 'www' SITE_DOMAIN_URI = 'gaultmillau.com' DOMAIN_URI = 'next.gaultmillau.com' - # ELASTICSEARCH SETTINGS ELASTICSEARCH_DSL = { 'default': { @@ -28,20 +27,17 @@ ELASTICSEARCH_DSL = { } } - ELASTICSEARCH_INDEX_NAMES = { 'search_indexes.documents.news': 'development_news', # temporarily disabled 'search_indexes.documents.establishment': 'development_establishment', 'search_indexes.documents.product': 'development_product', } - sentry_sdk.init( dsn="https://35d9bb789677410ab84a822831c6314f@sentry.io/1729093", integrations=[DjangoIntegration()] ) - BROKER_URL = 'redis://redis:6379/1' CELERY_RESULT_BACKEND = BROKER_URL CELERY_BROKER_URL = BROKER_URL @@ -53,4 +49,4 @@ LASTABLE_SERVICE = '' LASTABLE_TOKEN = '' LASTABLE_PROXY = '' -THUMBNAIL_FORCE_OVERWRITE = True # see: https://github.com/jazzband/sorl-thumbnail/issues/351 \ No newline at end of file +COOKIE_DOMAIN = '.gaultmillau.com' diff --git a/project/settings/stage.py b/project/settings/stage.py index 49a7ae0f..95285034 100644 --- a/project/settings/stage.py +++ b/project/settings/stage.py @@ -13,7 +13,6 @@ DEFAULT_SUBDOMAIN = 'www' SITE_DOMAIN_URI = 'id-east.ru' DOMAIN_URI = 'gm-stage.id-east.ru' - # ELASTICSEARCH SETTINGS ELASTICSEARCH_DSL = { 'default': { @@ -21,8 +20,9 @@ ELASTICSEARCH_DSL = { } } - ELASTICSEARCH_INDEX_NAMES = { # 'search_indexes.documents.news': 'stage_news', #temporarily disabled 'search_indexes.documents.establishment': 'stage_establishment', } + +COOKIE_DOMAIN = '.id-east.ru'