added COOKIE_DOMAIN parameter to settings

This commit is contained in:
Anatoly 2019-11-23 14:58:49 +03:00
parent d9743d8465
commit 9b61ff3114
6 changed files with 14 additions and 33 deletions

View File

@ -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):

View File

@ -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

View File

@ -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'

View File

@ -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
ELASTICSEARCH_DSL_AUTOSYNC = False

View File

@ -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
COOKIE_DOMAIN = '.gaultmillau.com'

View File

@ -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'