def create_admin(): try: username, password, email = input_user() User.create(username=username, password=password, email=email, isadmin=True).save() except: app_log.error( "The database table has not been created yet, you should first execute SpiderMan init" )
def create_database(): """创建数据库以及表""" models.get_datebase('mysql').execute_sql( "CREATE DATABASE {}".format('SpiderMan')) [models.get_datebase().execute_sql(sql) for sql in sum_sql] # 创建数据库表 username, password, email = input_user() User.create(username=username, password=password, email=email, isadmin=True).save()
def create_database(username=None, password=None, email="*****@*****.**"): """创建数据库以及表""" try: models.get_datebase('mysql').execute_sql( "CREATE DATABASE {}".format('SpiderMan')) [models.get_datebase().execute_sql(sql) for sql in sum_sql] # 创建数据库表 if not username or not password: username, password, email = input_user() User.create(username=username, password=password, email=email, isadmin=True).save() except peewee.ProgrammingError: pass