예제 #1
0
    if m != 'Model' and str(type(model)) == "<class 'peewee.BaseModel'>":
        if model.table_exists() == False:
            try:
                model.create_table()
            except Exception, e:
                pass
    elif str(type(model)) == "<type 'module'>":
        for m2 in dir(model):
            model2 = getattr(model, m2)
            if m2 not in ('Model') and str(
                    type(model2)) == "<class 'peewee.BaseModel'>":
                if model2.table_exists() == False:
                    try:
                        model2.create_table()
                    except Exception, e:
                        pass

# 执行安装
if 0 == wiki.models.Role.select().count():
    ar = wiki.models.Role()
    ar.code = 'admin'
    ar.name = '管理者'
    ar.save()

    ar = wiki.models.Role()
    ar.code = 'user'
    ar.name = '用户'
    ar.save()

Database.close()
예제 #2
0
파일: syncdb.py 프로젝트: 2life/wiki.catke
            try:
                model.create_table()
            except Exception, e:
                pass
    elif str(type(model)) == "<type 'module'>":
        for m2 in dir(model):
            model2 = getattr(model, m2)
            if m2 not in ('Model') and str(type(model2)) == "<class 'peewee.BaseModel'>":
                if model2.table_exists() == False:
                    try:
                        model2.create_table()
                    except Exception, e:
                        pass


# 执行安装
if 0 == wiki.models.Role.select().count():
    ar = wiki.models.Role()
    ar.code = 'admin'
    ar.name = '管理者'
    ar.save()

    ar = wiki.models.Role()
    ar.code = 'user'
    ar.name = '用户'
    ar.save()



Database.close()
예제 #3
0
파일: web.py 프로젝트: 2life/wiki.catke
 def on__finish(self):
     # 关闭主从数据库连接
     Database.close()
예제 #4
0
파일: web.py 프로젝트: QLGu/wiki.catke
 def on__finish(self):
     # 关闭主从数据库连接
     Database.close()