def create_db(db_filename, conf_filename, python_path, manage_path):
if not os.path.isfile(db_filename):
print("create:\tdb\t{0}".format(db_filename))
os.environ["SETTINGS"] = conf_filename
res = subprocess.check_output([python_path, manage_path, "db", "upgrade"])
if not res:
res = "OK"
print("result:\t{0}".format(res))
username = input("Choose a username for accessing Gthnk: ")
password = getpass("Choose a password:")
res = subprocess.check_output([python_path, manage_path, "user_add",
"-e", username, "-p", password])
if not res:
res = "OK"
print("result:\t{0}".format(res))
else:
print("exists:\t{0}".format(db_filename))
评论列表
文章目录