Use DATABASE_URL instead of DATABASE_* settings.
This commit is contained in:
Родитель
1789965f0b
Коммит
aefd70ba38
|
@ -3,6 +3,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import dj_database_url
|
||||
|
||||
from lib.settings_base import CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING
|
||||
|
||||
from .. import splitstrip
|
||||
|
@ -21,44 +23,25 @@ REDIRECT_SECRET_KEY = private.REDIRECT_SECRET_KEY
|
|||
|
||||
ADMINS = ()
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': private.DATABASES_DEFAULT_NAME,
|
||||
#'ENGINE': 'mysql_pool.base.db_pool',
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_DEFAULT_HOST,
|
||||
'PORT': private.DATABASES_DEFAULT_PORT,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
'sa_pool_key': 'master',
|
||||
},
|
||||
'slave': {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
#'ENGINE': 'mysql_pool.base.db_pool',
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_SLAVE_HOST,
|
||||
'PORT': private.DATABASES_SLAVE_PORT,
|
||||
'USER': private.DATABASES_SLAVE_USER,
|
||||
'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
'sa_pool_key': 'slave',
|
||||
},
|
||||
}
|
||||
DATABASES = {}
|
||||
DATABASES['default'] = dj_database_url.parse(private.DATABASES_DEFAULT_URL)
|
||||
DATABASES['default']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['default']['sa_pool_key'] = 'master'
|
||||
DATABASES['default']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
DATABASES['slave'] = dj_database_url.parse(private.DATABASES_SLAVE_URL)
|
||||
DATABASES['slave']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['slave']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
DATABASES['slave']['sa_pool_key'] = 'slave'
|
||||
|
||||
SERVICES_DATABASE = dj_database_url.parse(private.SERVICES_DATABASE_URL)
|
||||
|
||||
DATABASE_POOL_ARGS = {
|
||||
'max_overflow': 10,
|
||||
'pool_size':5,
|
||||
'pool_size': 5,
|
||||
'recycle': 30
|
||||
}
|
||||
|
||||
SERVICES_DATABASE = {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'HOST': private.DATABASES_SLAVE_HOST}
|
||||
|
||||
|
||||
SLAVE_DATABASES = ['slave']
|
||||
|
||||
CACHES = {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import dj_database_url
|
||||
|
||||
from lib.settings_base import CACHE_PREFIX, KNOWN_PROXIES, LOGGING
|
||||
|
||||
from .. import splitstrip
|
||||
|
@ -21,44 +23,25 @@ REDIRECT_SECRET_KEY = private.REDIRECT_SECRET_KEY
|
|||
|
||||
ADMINS = ()
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': private.DATABASES_DEFAULT_NAME,
|
||||
#'ENGINE': 'mysql_pool.base.db_pool',
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_DEFAULT_HOST,
|
||||
'PORT': private.DATABASES_DEFAULT_PORT,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
'sa_pool_key': 'master',
|
||||
},
|
||||
'slave': {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
#'ENGINE': 'mysql_pool.base.db_pool',
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_SLAVE_HOST,
|
||||
'PORT': private.DATABASES_SLAVE_PORT,
|
||||
'USER': private.DATABASES_SLAVE_USER,
|
||||
'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
'sa_pool_key': 'slave',
|
||||
},
|
||||
}
|
||||
DATABASES = {}
|
||||
DATABASES['default'] = dj_database_url.parse(private.DATABASES_DEFAULT_URL)
|
||||
DATABASES['default']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['default']['sa_pool_key'] = 'master'
|
||||
DATABASES['default']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
DATABASES['slave'] = dj_database_url.parse(private.DATABASES_SLAVE_URL)
|
||||
DATABASES['slave']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['slave']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
DATABASES['slave']['sa_pool_key'] = 'slave'
|
||||
|
||||
SERVICES_DATABASE = dj_database_url.parse(private.SERVICES_DATABASE_URL)
|
||||
|
||||
DATABASE_POOL_ARGS = {
|
||||
'max_overflow': 10,
|
||||
'pool_size':5,
|
||||
'pool_size': 5,
|
||||
'recycle': 30
|
||||
}
|
||||
|
||||
SERVICES_DATABASE = {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'HOST': private.DATABASES_SLAVE_HOST}
|
||||
|
||||
|
||||
SLAVE_DATABASES = ['slave']
|
||||
|
||||
CACHES = {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import dj_database_url
|
||||
|
||||
from lib.settings_base import CACHE_PREFIX, KNOWN_PROXIES, LOGGING, HOSTNAME
|
||||
|
||||
from .. import splitstrip
|
||||
|
@ -20,39 +22,22 @@ REDIRECT_SECRET_KEY = private.REDIRECT_SECRET_KEY
|
|||
|
||||
ADMINS = ()
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': private.DATABASES_DEFAULT_NAME,
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_DEFAULT_HOST,
|
||||
'PORT': private.DATABASES_DEFAULT_PORT,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
},
|
||||
'slave': {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_SLAVE_HOST,
|
||||
'PORT': private.DATABASES_SLAVE_PORT,
|
||||
'USER': private.DATABASES_SLAVE_USER,
|
||||
'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
},
|
||||
}
|
||||
DATABASES = {}
|
||||
DATABASES['default'] = dj_database_url.parse(private.DATABASES_DEFAULT_URL)
|
||||
DATABASES['default']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['default']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
SERVICES_DATABASE = {
|
||||
'NAME': private.SERVICES_DATABASE_NAME,
|
||||
'USER': private.SERVICES_DATABASE_USER,
|
||||
'PASSWORD': private.SERVICES_DATABASE_PASSWORD,
|
||||
'HOST': private.SERVICES_DATABASE_HOST,
|
||||
}
|
||||
DATABASES['slave'] = dj_database_url.parse(private.DATABASES_SLAVE_URL)
|
||||
DATABASES['slave']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['slave']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
SERVICES_DATABASE = dj_database_url.parse(private.SERVICES_DATABASE_URL)
|
||||
|
||||
SLAVE_DATABASES = ['slave']
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'caching.backends.memcached.CacheClass',
|
||||
'BACKEND': 'caching.backends.memcached.CacheClass',
|
||||
'LOCATION': splitstrip(private.CACHES_DEFAULT_LOCATION),
|
||||
'TIMEOUT': 500,
|
||||
'KEY_PREFIX': CACHE_PREFIX,
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import dj_database_url
|
||||
|
||||
from lib.settings_base import CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING
|
||||
|
||||
from .. import splitstrip
|
||||
|
@ -21,39 +23,23 @@ REDIRECT_SECRET_KEY = private.REDIRECT_SECRET_KEY
|
|||
|
||||
ADMINS = ()
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': private.DATABASES_DEFAULT_NAME,
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_DEFAULT_HOST,
|
||||
'PORT': private.DATABASES_DEFAULT_PORT,
|
||||
'USER': private.DATABASES_DEFAULT_USER,
|
||||
'PASSWORD': private.DATABASES_DEFAULT_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
},
|
||||
'slave': {
|
||||
'NAME': private.DATABASES_SLAVE_NAME,
|
||||
'ENGINE': 'mysql_pool',
|
||||
'HOST': private.DATABASES_SLAVE_HOST,
|
||||
'PORT': private.DATABASES_SLAVE_PORT,
|
||||
'USER': private.DATABASES_SLAVE_USER,
|
||||
'PASSWORD': private.DATABASES_SLAVE_PASSWORD,
|
||||
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
||||
},
|
||||
}
|
||||
DATABASES = {}
|
||||
DATABASES['default'] = dj_database_url.parse(private.DATABASES_DEFAULT_URL)
|
||||
DATABASES['default']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['default']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
DATABASES['slave'] = dj_database_url.parse(private.DATABASES_SLAVE_URL)
|
||||
DATABASES['slave']['ENGINE'] = 'mysql_pool'
|
||||
DATABASES['slave']['OPTIONS'] = {'init_command': 'SET storage_engine=InnoDB'}
|
||||
|
||||
SERVICES_DATABASE = dj_database_url.parse(private.SERVICES_DATABASE_URL)
|
||||
|
||||
DATABASE_POOL_ARGS = {
|
||||
'max_overflow': 10,
|
||||
'pool_size':5,
|
||||
'pool_size': 5,
|
||||
'recycle': 30
|
||||
}
|
||||
|
||||
SERVICES_DATABASE = {
|
||||
'NAME': private.SERVICES_DATABASE_NAME,
|
||||
'USER': private.SERVICES_DATABASE_USER,
|
||||
'PASSWORD': private.SERVICES_DATABASE_PASSWORD,
|
||||
'HOST': private.SERVICES_DATABASE_HOST}
|
||||
|
||||
SLAVE_DATABASES = ['slave']
|
||||
|
||||
CACHES = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче