# coding: utf-8
import os
import helios.rpc

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOST = ['*']

# RPC_URL = 'http://rpc.hotfix2.gmei.com/api/'
RPC_URL = 'http://rpc.test.gmei.com/api/'
# RPC_URL = 'http://rpc.dev.gmei.com/api/'
#RPC_URL = 'http://127.0.0.1:8001/api/'
RPC_SECRET = ''
RPC_CLIENT = helios.rpc.RPCFactory(
    RPC_URL,
    RPC_SECRET,
    debug=DEBUG,
    debug_dump_curl=True,
).create_invoker()
# RPC_CLIENT = helios.rpc.create_default_invoker(debug=DEBUG)

APP_CONFIG = {
    'url_base': 'http://127.0.0.1:9000',
    'app_download_page': '/app/download',
    'mobile_index_page': 'http://ship-service.default/',
    'qiniu_host': 'http://pic.gmei.com/',
    'default_paging_size': 20,
    'qiniu_prefix': 'http://pic.gmei.com',
    'all_category_icon_url': 'http://hera.s.gmei.com/img/quanbufenlei.png',
    'session_cookie_name': 'shipsessionid',
    'cross_domain': '.gmei.com',
}

class APP_CONFIG_CLASS(object):
    qiniu_prefix = 'http://pic.gmei.com'
    all_category_icon_url = 'http://hera.s.gmei.com/img/quanbufenlei.png'
    session_cookie_name = 'shipsessionid'
    # cross_domain = '.gmei.com'
    cross_domain = 'http://127.0.0.1:9000'

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://192.168.168.142/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        }
    }
}

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# NOTE:django
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':memory:',
    }
}

APPEND_SLASH = False

BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, '..', 'frontend', 'templates'),
)
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.jinja2.Jinja2',
        'DIRS': (
            TEMPLATE_DIRS
        ),
        'APP_DIRS': True,
        'OPTIONS': {
            'environment': 'app.utils.environment',
        },
    }
]
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, '..', 'frontend', 'static'),
)
STATIC_URL = '/static/'
STATIC_ROOT = ''
# STATIC_ROOT = os.path.join(BASE_DIR, '..', 'frontend', 'static')
# STATIC_ROOT = '/srv/apps/flag-ship/frontend/static'
