configParse.py 679 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import configparser
import pymysql.cursors
import os

base_dir = str(os.path.dirname(os.path.dirname(__file__)))
config_dir = base_dir.replace('\\', '/')
config_path = config_dir + '/config.ini'

cp = configparser.ConfigParser()
cp.read(config_path)
DB_host = cp.get('mysqlconf', 'host')
DB_port = cp.get('mysqlconf', 'port')
DB_username = cp.get('mysqlconf', 'user')
DB_password = cp.get('mysqlconf', 'password')
DB_dbName = cp.get('mysqlconf', 'db_name')

userPhone = cp.get('userinfo', 'userPhone')
deviceNumber = cp.get('userinfo','deviceNumber')
admin_host = 'http://admin.test.hjx.com/'
boss_host = 'http://boss.test.hjx.com/'