DATABASES = {
    'default': {  # mysql
        'ENGINE': 'django.db.backends.mysql',
        # 'NAME': 'mimas_dev',
        'NAME': 'mimas_test',
        'USER': 'work',
        'PASSWORD': 'Gengmei1',
        # 'HOST': '127.0.0.1',
        'HOST': 'local-mysql',
        'PORT': '3306',
        'OPTIONS': {
            "init_command": "SET foreign_key_checks = 0;",
            "charset": "utf8mb4",
        },
    },
    'slave': {  # mysql
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mimas_dev',
        'USER': 'work',
        'PASSWORD': 'Gengmei1',
        # 'HOST': '127.0.0.1',
        'HOST': 'local-mysql',
        'PORT': '3306',
        'OPTIONS': {
            "init_command": "SET foreign_key_checks = 0;",
            "charset": "utf8mb4",
        },
    },
}

CELERY_TIMEZONE = 'Asia/Shanghai'
BROKER_URL = 'redis://192.168.168.142:6379/10'
CELERY_BROKER_URL = 'redis://192.168.168.142:6379/10'
CELERY_TASK_SERIALIZER = "json"
SENTRY_CELERY_ENDPOINT = ''

BACKEND_API_HOST = 'http://backend-service.default'

# 初始化数据
INIT_DATA = True

# qa hack num
ANSWER_HACK_STRT = '-'

QINIU_CDN_HOST = u'http://pic.igengmei.com/'

MULTI_TOPIC_TAG_ID = 5089

GM_SERIALIZER = {
    'redis': {
        'host': '192.168.168.142', 'port': 6379, 'db': 1, 
    }
}


TEST_RUNNER = 'gm_test.runner.GmTestRunner'

REDIS = {
    'default': {'host': '192.168.168.142', 'port': 6379, 'db': 0, },
    'view': {'host': '192.168.168.142', 'port': 6379, 'db': 1, },
    'answer_sort_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 4, },
    'high_quality_question_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 5, },
    'vote_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 6, },
    'page_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 10, },
    'social_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 11, },
    'user_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 12, },
}

DATABASE_ROUTERS = ['utils.router.ThreadLocalRouter',]

LIVE_REDIS = {'host': '192.168.168.142', 'port': 6379, 'db': 7, }
DEFAULT_REDIS = {'host': '192.168.168.142', 'port': 6379, 'db': 8, }
DBMW_LOGICAL_DATABASE_ID = 'gaia-zhengxing'
MIMAS_LOGICAL_DATABASE_ID = 'mimas-zhengxing'
TALOS_RPC_CACHE = {'host': '192.168.168.142', 'port': 6379, 'db': 9, }

# from base
REDIS_CONF = {'host': '192.168.168.142', 'port': 6379, 'db': 0, }

REDIS_MIGRATE = (
    {
        # gaia view_cache addr.
        'source': {'host': '192.168.168.142', 'port': 7777, 'db': 1, },
        'prefix': ('question_view', 'answer_view'),
        'target': REDIS['view']
    },
    {
        # gaia answer_sort_cache addr:
        'source': {'host': '192.168.168.142', 'port': 7777, 'db': 2, },
        'prefix': ('answer_sort_cache',),
        'target': REDIS['answer_sort_cache']
    },
    {
        # gaia vote_cache addr.
        'source': {'host': '192.168.168.142', 'port': 7777, 'db': 2, },
        'prefix': ('vote_cache',),
        'target': REDIS['vote_cache']
    },
)
# topic 迁移一期,暂时共用gaia redis
REDIS_TOPIC_1ST = {
    'default': {'host': '192.168.168.142', 'port': 6379, 'db': 14, },  # gaia settings.DEFAULT_REDIS
    'view': {'host': '192.168.168.142', 'port': 6379, 'db': 2, },  # gaia settings.REDIS['view']
    'talos_rpc_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 14, },  # gaia settings.TALOS_RPC_CACHE
    'user_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 5, },  # gaia settings.REDIS['user_cache']
    'page_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 15, },  # gaia settings.REDIS['page_cache']
    'vote_cache': {'host': '192.168.168.142', 'port': 6379, 'db': 11, },  # gaia settings.REDIS['vote_cache']
}
REDIS_MIGRATE_TALOS = (
    {
        # gaia REDIS view addr.
        'source': {'host': '192.168.168.142', 'port': 7777, 'db': 1, },
        'prefix': ('diary_pv',),
        'target': REDIS['view']
    },
)
ES_HOSTS = [
    {'host': '192.168.168.142', 'port': 9200},
]

QINIU_ACCESS_KEY = "UPCOYIJkZOMcdd9FDzpBqYjzWUh55fBpVi3AhWpL"
QINIU_SECRET_KEY = "z5YvpDDSam_JE345Z8J_f3TufzelOW2VOGNoBl9e"

QINIU_LIVE_DOMAIN = u'pili-publish.live-test.igengmei.com'
QINIU_HUB_NAME = u'igengmei-live-test'
QINIU_LIVE_TIMEOUT = 3600
QINIU_REPLAY_LIVE_DOMAIN = u'http://live-static-test.igengmei.com/'
QINIU_TEMP_CDN_HOST = u'http://pic-tmp.igengmei.com/'
