def make_sure_mysql_usable():
# mysql is lazily connected to in django.
# connection.connection is None means
# you have not connected to mysql before
if connection.connection and not connection.is_usable():
# destroy the default mysql connection
# after this line, when you use ORM methods
# django will reconnect to the default mysql
del connections._connections.default
#
# def get_item(data_dict,item):
# try:
# item_value = data_dict[item]
# return item_value
# except:
# return '-1'
#
# def get_config(group,config_name):
# config = ConfigParser.ConfigParser()
# config.readfp(open('./myapp/etc/config.ini','r'))
# config_value=config.get(group,config_name).strip(' ').strip('\'').strip('\"')
# return config_value
#
# def filters(data):
# return data.strip(' ').strip('\n').strip('\br')
#
# select_limit = int(get_config('settings','select_limit'))
# export_limit = int(get_config('settings','export_limit'))
# host = get_config('settings','host')
# port = get_config('settings','port')
# user = get_config('settings','user')
# passwd = get_config('settings','passwd')
# dbname = get_config('settings','dbname')
# wrong_msg = get_config('settings','wrong_msg')
# incp_host = get_config('settings','incp_host')
# incp_port = int(get_config('settings','incp_port'))
# incp_user = get_config('settings','incp_user')
# incp_passwd = get_config('settings','incp_passwd')
# public_user = get_config('settings','public_user')
评论列表
文章目录