Example #1
0
def getConnect():
    host = 'localhost'
    port = 3306
    database = 'weixinarticle'
    user = '******'
    charset="utf8"
    import socket
    if socket.gethostname() == 'iZ23au1sj8vZ':
        from gather import utils
        password = utils.get_real_config("database_password")
    else:
        password = '******'
    
    return MySQLdb.connect(host=host, port=port, db=database,user=user,passwd=password,charset=charset)
Example #2
0
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'weixinarticle.urls'

WSGI_APPLICATION = 'weixinarticle.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
if socket.gethostname() == 'iZ23au1sj8vZ':
    from gather import utils
    database_password = utils.get_real_config("database_password")
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'HOST': '127.0.0.1',
            'PORT': '3306',
            'NAME': 'weixinarticle',
            'USER': '******',
            'PASSWORD': database_password,
        }
    }
else:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'HOST': '127.0.0.1',