def init(request): users = Users() users.username = "******" # md5 = hashlib.md5() # md5.update('初始化完成!'.encode()) # pw = md5.hexdigest() pw = my_md5("222") users.password = pw users.save() return HttpResponse("初始化完成!")
def init(request): username = "******" password = "******" users = Users() users.username = username users.password = password try: users.save() except IntegrityError: return HttpResponse("用户名重复!") return HttpResponse("ok")