<s> import os <EOL> from peewee import * <EOL> from playhouse . pool import PooledMySQLDatabase <EOL> from playhouse . sqlite_ext import SqliteExtDatabase <EOL> import ConfigParser <EOL> config = ConfigParser . ConfigParser ( ) <EOL> config . read ( <EOL> os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> db_engine = config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if db_engine == '<STR_LIT>' : <EOL> db_name = config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> db = SqliteExtDatabase ( db_name , threadlocals = True , journal_mode = '<STR_LIT>' ) <EOL> elif db_engine == '<STR_LIT>' : <EOL> db_username = config . get ( '<STR_LIT>' , '<STR_LIT:username>' ) <EOL> db_password = config . get ( '<STR_LIT>' , '<STR_LIT:password>' ) <EOL> db_database = config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> db_dbhost = config . get ( '<STR_LIT>' , '<STR_LIT:host>' ) <EOL> db = PooledMySQLDatabase ( <EOL> db_database , <EOL> max_connections = <NUM_LIT:32> , <EOL> stale_timeout = <NUM_LIT> , <EOL> host = db_dbhost , <EOL> user = db_username , <EOL> passwd = db_password <EOL> ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> class BaseModel ( Model ) : <EOL> '''<STR_LIT>''' <EOL> class Meta : <EOL> database = db </s>
