import os
if ‘SERVER_SOFTWARE’ in os.environ:
from sae.const import (
MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB
)
else:
MYSQL_HOST = ‘localhost’
MYSQL_PORT = ’3306′
MYSQL_USER = ‘user’
MYSQL_PASS = ‘password’
MYSQL_DB = ‘app_mysite’
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: MYSQL_DB,
‘USER’: MYSQL_USER,
‘PASSWORD’: MYSQL_PASS,
‘HOST’: MYSQL_HOST,
‘PORT’: MYSQL_PORT,
}
}
转载请注明:王杭州的个人网页 » sae环境下本地开发MySQL和发布MySQL变量的设置