<s> import peewee <EOL> db = peewee . SqliteDatabase ( '<STR_LIT>' ) <EOL> class CDN ( peewee . Model ) : <EOL> id = peewee . CharField ( primary_key = True ) <EOL> name = peewee . CharField ( null = True ) <EOL> edge_server = peewee . CharField ( null = True ) <EOL> class Meta : <EOL> database = db <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> def __unicode__ ( self ) : <EOL> return self . __str__ ( ) <EOL> class Host ( peewee . Model ) : <EOL> hostname = peewee . CharField ( primary_key = True ) <EOL> cdn = peewee . ForeignKeyField ( CDN , null = True ) <EOL> uses_ssl = peewee . BooleanField ( default = False ) <EOL> is_active = peewee . BooleanField ( default = True ) <EOL> class Meta : <EOL> database = db <EOL> def __eq__ ( self , other ) : <EOL> return self . hostname == other . hostname <EOL> def __str__ ( self ) : <EOL> return self . hostname <EOL> def __unicode__ ( self ) : <EOL> return self . __str__ ( ) <EOL> DoesNotExist = peewee . DoesNotExist <EOL> def initialize_database ( db_filename , reset = False ) : <EOL> db . database = db_filename <EOL> if reset : <EOL> Host . drop_table ( True ) <EOL> CDN . drop_table ( True ) <EOL> CDN . create_table ( True ) <EOL> Host . create_table ( True ) <EOL> return db </s>
