def userAPI(request): # 判断用户是否登陆,同时判断用户登录的是否是管理员账号 try: isLogin = isLoginTrue(request) if isLogin == 0 or isLogin == -1: redirectTitle = "请登录之后再进行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) except Exception as e: redirectTitle = "超出权限,请登录管理员账号后再执行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) # 判断是否管理登陆完成,如果是,则执行以下代码,否则已经在上述代码中跳转到指定页面。 # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) nav = 'api' pagetitle = "API中心" userData = currency.models.UserModel.objects.get(uid=isLogin[2]) secretid = userData.username secretkey = md5( (str(md5(str(userData.password).encode("utf-8"))) + "=!liuyublog-liuyublog!=" + str(md5(str(userData.username).encode("utf-8")))).encode("utf-8")) return render( request, "usercenter/%s/%s" % (information.getValue("templatesUserCenterName"), "api.html"), locals())
def resumeIndex(request): mobile = 1 if "android" in str(request.META["HTTP_USER_AGENT"]).lower(): mobile = 2 if "iphone" in str(request.META["HTTP_USER_AGENT"]).lower(): mobile = 2 information = Information() totalInfor = information.getAll() moduleData = random.choice( resume.models.ResumeModel.objects.filter(keyData="template")) moduleDataTem = moduleData.valueData totalTempData = resume.models.ResumeModel.objects.all() totalData = {} haveKey = [] for eveData in totalTempData: if eveData.keyData in haveKey: totalData[eveData.keyData].append(eveData.valueData) else: haveKey.append(eveData.keyData) totalData[eveData.keyData] = [] totalData[eveData.keyData].append(eveData.valueData) return render(request, "resume/%s/index.html" % (moduleDataTem), locals())
def sendEmail(username, email, content): import smtplib information = Information() from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.header import Header try: title = content[0] text = content[1] sender = email msgRoot = MIMEMultipart('related') msgRoot['From'] = Header("Liu Yu", 'utf-8') msgRoot['To'] = Header(username, 'utf-8') subject = title msgRoot['Subject'] = Header(subject, 'utf-8') msgAlternative = MIMEMultipart('alternative') msgRoot.attach(msgAlternative) mail_msg = text msgAlternative.attach(MIMEText(mail_msg, 'html', 'utf-8')) try: server_con = smtplib.SMTP_SSL(information.getValue("emailSMTP"), information.getValue("emailPort")) server_con.login(information.getValue("emailUser"), information.getValue("emailPassword")) # 登录服务器 server_con.sendmail(information.getValue("emailUser"), sender, msgRoot.as_string()) server_con.close() return True except Exception as e: errorLogger(e) except Exception as e: errorLogger(e) return False
def registerPage(request): information = Information() webtitle = information.getValue("webName") keywords = information.getValue("webKeyword") description = information.getValue("webDescription") try: isLogin = isLoginTrue(request) if isLogin[0] == 1: if isLogin[1] == "1": redirectTitle = "您已经登陆,无需重复登录" redirectUrl = "/admin/index" return render(request, "currency/loginAndRegister/handle.html", locals()) if isLogin[1] == "2": redirectTitle = "您已经登陆,无需重复登录" redirectUrl = "/usercenter/index" return render(request, "currency/loginAndRegister/handle.html", locals()) except Exception as e: errorLogger(e) if request.method == "POST": username = request.POST.get("name") password = request.POST.get("password") email = request.POST.get("email") qq = request.POST.get("qq") phone = request.POST.get("phone") photoFile = random.choice([i for i in range(41)]) try: if usercenter.models.UserModel.objects.all().count() == 0: type = "1" else: type = "2" usercenter.models.UserModel.objects.create( username = username, password = password, sex = "3", email = email, qq = qq, phone = phone, type = type, state = "1", photo = "/files/userFace/%d.jpg" % (photoFile) ) redirectTitle = "注册成功" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) except Exception as e: wrongMessage = "注册失败!用户名等信息已被占用!" errorLogger(e) return render(request, "currency/loginAndRegister/register.html", locals())
def wrongPageIndex(request): try: information = Information() webtitle = information.getValue("webName") keywords = information.getValue("webKeyword") description = information.getValue("webDescription") isFirstTime = True errorNumber = request.session["errorNumber"] del request.session["errorNumber"] errorDescription = wrongNumber(errorNumber) return render(request, "currency/wrongPage/index.html", locals()) except: request.session["errorNumber"] = "100004" return redirect("/wrong")
def videoContent(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): category = video.models.VideoModel.objects.all().order_by("-vid") tempList = [] try: for eveTemp in category: videoDataTitle = eveTemp.titleList videoDataUrl = eveTemp.urlList if "&title&" in videoDataTitle: videoDataTitle = videoDataTitle.split("&title&") else: videoDataTitle = [videoDataTitle] if "&url&" in videoDataUrl: videoDataUrl = videoDataUrl.split("&url&") else: videoDataUrl = [videoDataUrl] returnData = [] for i in range(0, len(videoDataTitle)): returnData.append((videoDataTitle[i], videoDataUrl[i])) tempList.append((eveTemp.name, returnData, eveTemp.vid)) category = tempList except: pass return render( request, "video/%s/%s" % (information.getValue("templatesVideoName"), "index.html"), locals()) else: return redirect("/sorry") except Exception as e: errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def albumContent(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] loginId = isLoginTrue(request) try: isloginData = True userId = loginId[2] except Exception as e: errorLogger(e) isloginData = False if ipCounter(userIP, information.getValue("maxCounter")): category = currency.models.CategoryModel.objects.filter(type="3") aid = request.GET.get("aid") if aid: categoryData = category.get(cid=aid) pictureData = album.models.ImagesModel.objects.filter( album=categoryData, is_recommend=True).order_by("-iid") else: pictureData = list( album.models.ImagesModel.objects.filter( is_recommend=True).order_by("-iid")) random.shuffle(pictureData) pictureData = pictureData[0:20] return render( request, "album/%s/%s" % (information.getValue("templatesAlbumName"), "index.html"), locals()) else: return redirect("/sorry") except Exception as e: errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def maxCounterIndex(request): information = Information() webtitle = information.getValue("webName") keywords = information.getValue("webKeyword") description = information.getValue("webDescription") isFirstTime = True title = "抱歉" if request.method == "POST": email = request.POST.get("email") sendEmail("管理员","*****@*****.**",("来自用户的请求","收到了反爬虫解除请求,用户的邮箱是%s"%(email))) sendEmail("用户", email, ("来自刘宇的博客", "已经收到了您申请解除反爬虫限制的请求,请确保您的邮箱:%s是正确的。" % (email))) title = "感谢支持" isFirstTime = False return render(request, "currency/maxCounter/index.html", locals())
def webIndex(request): try: if "android" in str(request.META["HTTP_USER_AGENT"]).lower(): phoneData = "true" if "iphone" in str(request.META["HTTP_USER_AGENT"]).lower(): phoneData = "true" # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) # 每日一句 sentenceData = Sentence() (sentence, author) = sentenceData.getOneSentence() sentence = sentence[0:-1] numData = [x for x in range(1, 192)] picNum = random.choice(numData) isLogin = isLoginTrue(request) if isLogin == 0 or isLogin == -1: webIndexData = 0 # 未登陆 else: webIndexData = 1 # 已登陆 try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): return render(request,"currency/indexPage/index.html",locals()) else: return redirect("/sorry") except Exception as e: print(e) errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def userIndex(request): # 判断用户是否登陆,同时判断用户登录的是否是管理员账号 try: isLogin = isLoginTrue(request) if isLogin == 0 or isLogin == -1: redirectTitle = "请登录之后再进行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) except Exception as e: redirectTitle = "超出权限,请登录管理员账号后再执行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) # 判断是否管理登陆完成,如果是,则执行以下代码,否则已经在上述代码中跳转到指定页面。 # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) nav = 'index' pagetitle = "仪表盘" userData = currency.models.UserModel.objects.get(uid=isLogin[2]) articleData = currency.models.ArticleModel.objects.all().order_by("-aid") comments = currency.models.CommentsModel.objects.all() tempComments = [] for eve in comments.filter(username=userData.username, usertype=1): tempComments.append((eve, comments.filter(pid=eve.cid))) if comments.filter(username=userData.username, usertype=1).count() > 6: articleData = articleData[ 0:comments.filter(username=userData.username, usertype=1).count()] else: articleData = articleData[0:6] return render( request, "usercenter/%s/%s" % (information.getValue("templatesUserCenterName"), "index.html"), locals())
def projectContent(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): return render( request, "project/%s/%s" % (information.getValue("templatesProjectName"), "index.html"), locals()) else: return redirect("/sorry") except Exception as e: print(e) errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def loginPage(request): information = Information() webtitle = information.getValue("webName") keywords = information.getValue("webKeyword") description = information.getValue("webDescription") try: isLogin = isLoginTrue(request) if isLogin[0] == 1: if isLogin[1] == "1": return redirect("/admin/index") if isLogin[1] == "2": return redirect("/usercenter/index") except Exception as e: errorLogger(e) if request.method == "POST": username = request.POST.get("name") email = request.POST.get("email") password = request.POST.get("password") loginData = isUserTrue(username, password, email) if loginData == 0: wrongMessage = "登陆失败!请检查信息是否正确!" elif loginData[0] == 1: request.session["login"] = "******" % (loginData[0],loginData[1], username, password, email) redirectTitle = "管理员登陆成功" redirectUrl = "/admin/index" return render(request, "currency/loginAndRegister/handle.html", locals()) else: request.session["login"] = "******" % (loginData[0],loginData[1], username, password, email) redirectTitle = "用户登陆成功" redirectUrl = "/index" return render(request, "currency/loginAndRegister/handle.html", locals()) return render(request, "currency/loginAndRegister/login.html", locals())
def blogIndex(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): # 头部名人名言 sentenceData = Sentence() (sentence, author) = sentenceData.getOneSentence() sentence = sentence[0:-1] tagsData = currency.models.TagsModel.objects.filter( type=1).order_by("?")[0:20] categoryList = currency.models.CategoryModel.objects.filter(type=1) articleData = currency.models.ArticleModel.objects.filter( is_recommend=False).order_by("-aid") totalCount = articleData.count() if articleData.count() > 0: hotData = articleData.order_by("-click_count")[0:3] firstData = articleData[0] firstPicData = getDeafulatPic(firstData.content).replace( "blog", "backblog") if articleData.count() >= 1: articleData = articleData[1:] try: pageNum = int(request.GET.get("page", 1)) except Exception as e: errorLogger(e) pageNum = 1 paginator = Paginator(articleData, 12) # 对传递过来的页面进行判断,页码最小为1,最大为分页器所得总页数 if pageNum < 0: pageNum = 1 if pageNum > paginator.num_pages: pageNum = paginator.num_pages # 分页器获得当前页面的数据内容 articleList = paginator.page(pageNum) articleResult = [] for eveData in articleList: picUrl = getDeafulatPic(eveData.content) articleResult.append( (eveData, picUrl.replace("blog", "backblog"))) hotList = [] for eveHotData in hotData: picUrl = getDeafulatPic(eveHotData.content) hotList.append( (eveHotData, picUrl.replace("blog", "backblog"))) if pageNum == 1: pageTitle = "博客首页" else: pageTitle = "第%d页" % (pageNum) else: noData = True return render( request, "blog/%s/%s" % (information.getValue("templatesBlogName"), "list.html"), locals()) else: return redirect("/sorry") except Exception as e: print(e) errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def blogArticle(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): # 头部名人名言 sentenceData = Sentence() (sentence, author) = sentenceData.getOneSentence() sentence = sentence[0:-1] tagsData = currency.models.TagsModel.objects.filter( type=1).order_by("?")[0:20] categoryList = currency.models.CategoryModel.objects.filter(type=1) aidData = request.GET.get("aid") articleData = currency.models.ArticleModel.objects.get(aid=aidData) if not articleData.is_recommend: clickCount = int(articleData.click_count) + 1 currency.models.ArticleModel.objects.filter( aid=aidData).update(click_count=clickCount) articleListTemp = currency.models.ArticleModel.objects.filter( is_recommend=False) articleList = articleListTemp.order_by("-aid") totalCount = articleList.count() # recommend = RecommendedHandle(numCount=5) # otherArticle = [] # for eveArticle in articleList: # if str(aidData) == str(eveArticle.aid): # articleData = eveArticle # else: # otherArticle.append((eveArticle.aid,"%s,%s,%s"%(eveArticle.title,eveArticle.category.name,eveArticle.desc))) # recommendList = recommend.getArticleList("%s,%s,%s"%(articleData.title,articleData.category.name,articleData.desc),otherArticle) # recommendArticle = [] # for eveArticle in recommendList: # tempArticle = currency.models.ArticleModel.objects.get(aid=eveArticle) # recommendArticle.append((tempArticle,getDeafulatPic(tempArticle.content).replace("blog","backblog"))) recommendArticleData = articleListTemp.order_by( "-click_count")[0:3] recommendArticle = [] for eveHotData in recommendArticleData: picUrl = getDeafulatPic(eveHotData.content) recommendArticle.append( (eveHotData, picUrl.replace("blog", "backblog"))) loginId = isLoginTrue(request) totalUser = usercenter.models.UserModel.objects.all() try: isLogin = True userId = loginId[2] userData = totalUser.get(uid=userId) except Exception as e: errorLogger(e) isLogin = False if request.method == "POST": username = request.POST.get("name") email = request.POST.get("email") comment = request.POST.get("comment") comment = filterTags(comment) spamData = SpamHandle(comment).getSpam() ''' cid = models.AutoField(primary_key=True) content = models.TextField(verbose_name="评论内容") date_publish = models.DateTimeField(auto_now_add=True, verbose_name="发布时间") username = models.CharField(max_length=50, verbose_name="用户") usertype = models.IntegerField(default=0, verbose_name="用户类型") qq = models.CharField(max_length=13, blank=True, null=True, verbose_name="QQ号") mobile = models.CharField(max_length=11, blank=True, null=True, unique=True, verbose_name="电话号") pid = models.ForeignKey('self', blank=True, null=True, verbose_name="父级评论") is_recommend = models.BooleanField(default=True, verbose_name="是否显示") watched = models.BooleanField(default=True, verbose_name="是否查看") email = models.CharField(max_length=50, verbose_name="邮箱") article = models.CharField(max_length=50, verbose_name="文章") ''' if spamData: try: username = userData.username email = userData.email typeData = 1 except: typeData = 0 # 登录用户的typeData是1,否则是0 currency.models.CommentsModel.objects.create( username=username, email=email, content=comment, is_recommend=False, watched=False, article_title=articleData.title, article=articleData, usertype=typeData, ) stateData = "留言成功,我会尽快审核,给您反馈!感谢您的支持哦!" else: stateData = "系统判断,您的信息可能是垃圾信息,维护网络信息整洁是我们每个公民的义务!请您重新发送!" commenData = currency.models.CommentsModel.objects.filter( article=aidData, is_recommend=False).order_by("-cid") comm = [] tempHave = [] for eveComment in commenData: if eveComment.pid: if eveComment.pid.is_recommend: if eveComment.pid.cid not in tempHave: if eveComment.usertype == 1: comm.append( (eveComment, totalUser.get(username=eveComment. username).photo)) else: comm.append( (eveComment, "/files/userFace/1.jpg")) tempHave.append(eveComment.pid.cid) else: if eveComment.cid not in tempHave: if eveComment.usertype == 1: comm.append( (eveComment, totalUser.get( username=eveComment.username).photo)) else: comm.append( (eveComment, "/files/userFace/1.jpg")) return render( request, "blog/%s/%s" % (information.getValue("templatesBlogName"), "content.html"), locals()) else: request.session["errorNumber"] = "100009" return redirect("/wrong") else: return redirect("/sorry") except Exception as e: errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def blogList(request): try: # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) try: userIP = request.META["HTTP_X_FORWARDED_FOR"] except: userIP = request.META["REMOTE_ADDR"] if ipCounter(userIP, information.getValue("maxCounter")): # 头部名人名言 sentenceData = Sentence() (sentence, author) = sentenceData.getOneSentence() sentence = sentence[0:-1] articleData = currency.models.ArticleModel.objects.filter( is_recommend=False).order_by("-aid") totalCount = articleData.count() tagsData = currency.models.TagsModel.objects.filter( type=1).order_by("?")[0:20] categoryList = currency.models.CategoryModel.objects.filter(type=1) searchData = request.GET.get("search", None) if searchData: tempList = [] for eveArticle in articleData: tempList.append( (eveArticle.title, filterTags(eveArticle.content), str(eveArticle.aid))) searchHandle = SearchArticleHandle(tempList) articleAidData = searchHandle.getResult(searchData) searchArticleData = [] for eveAid in articleAidData: searchArticleData.append(articleData.get(aid=eveAid)) pageNum = 1 if len(searchArticleData) > 0: hotData = articleData.order_by("-click_count")[0:3] firstData = searchArticleData[0] firstPicData = getDeafulatPic(firstData.content) if len(articleData) >= 1: articleData = searchArticleData[1:] else: articleData = [] try: pageNum = int(request.GET.get("page", 1)) except Exception as e: errorLogger(e) paginator = Paginator(articleData, 12) # 对传递过来的页面进行判断,页码最小为1,最大为分页器所得总页数 if pageNum < 0: pageNum = 1 if pageNum > paginator.num_pages: pageNum = paginator.num_pages # 分页器获得当前页面的数据内容 articleList = paginator.page(pageNum) articleResult = [] for eveData in articleList: picUrl = getDeafulatPic(eveData.content) articleResult.append((eveData, picUrl)) hotList = [] for eveHotData in hotData: picUrl = getDeafulatPic(eveHotData.content) hotList.append((eveHotData, picUrl)) else: noData = True pageTempTitle = searchData + "搜索结果" if pageNum == 1: pageTitle = pageTempTitle else: pageTitle = "第%d页 - %s" % (pageNum, pageTempTitle) else: category = request.GET.get("cate", None) tag = request.GET.get("tag", None) categoryMainData = None tagMainData = None if category: categoryMainData = currency.models.CategoryModel.objects.get( cid=category) articleData = articleData.filter( category=categoryMainData, is_recommend=False).order_by("-aid") elif tag: tagMainData = currency.models.TagsModel.objects.get( tid=tag) articleData = articleData.filter( tag=tagMainData).order_by("-aid") pageNum = 1 if articleData.count() > 0: hotData = articleData.order_by("-click_count")[0:5] firstData = articleData[0] firstPicData = getDeafulatPic(firstData.content).replace( "blog", "backblog") if articleData.count() >= 1: articleData = articleData[1:] else: articleData = [] try: pageNum = int(request.GET.get("page", 1)) except Exception as e: errorLogger(e) paginator = Paginator(articleData, 12) # 对传递过来的页面进行判断,页码最小为1,最大为分页器所得总页数 if pageNum < 0: pageNum = 1 if pageNum > paginator.num_pages: pageNum = paginator.num_pages # 分页器获得当前页面的数据内容 articleList = paginator.page(pageNum) articleResult = [] for eveData in articleList: picUrl = getDeafulatPic(eveData.content) articleResult.append( (eveData, picUrl.replace("blog", "backblog"))) hotList = [] for eveHotData in hotData: picUrl = getDeafulatPic(eveHotData.content) hotList.append( (eveHotData, picUrl.replace("blog", "backblog"))) else: noData = True if categoryMainData: pageTempTitle = categoryMainData.name elif categoryMainData: pageTempTitle = tagMainData.name else: pageTempTitle = "全部博文" if pageNum == 1: pageTitle = pageTempTitle else: pageTitle = "第%d页 - %s" % (pageNum, pageTempTitle) return render( request, "blog/%s/%s" % (information.getValue("templatesBlogName"), "list.html"), locals()) else: return redirect("/sorry") except Exception as e: print(e) errorLogger(e) request.session["errorNumber"] = "100004" return redirect("/wrong")
def userInfor(request): # 判断用户是否登陆,同时判断用户登录的是否是管理员账号 try: isLogin = isLoginTrue(request) if isLogin == 0 or isLogin == -1: redirectTitle = "请登录之后再进行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) except Exception as e: redirectTitle = "超出权限,请登录管理员账号后再执行操作" redirectUrl = "/login" return render(request, "currency/loginAndRegister/handle.html", locals()) # 判断是否管理登陆完成,如果是,则执行以下代码,否则已经在上述代码中跳转到指定页面。 if request.method == "POST": ''' email [email protected] password liuyuliuyu phone 13500993691 photo /files/userFace/39.jpg qq sex 男 username liuyu wechat None ''' try: userData = currency.models.UserModel.objects.get(uid=isLogin[2]) email = request.POST.get("email", userData.email) password = request.POST.get("password", userData.password) phone = request.POST.get("phone", userData.phone) photo = request.POST.get("photo", userData.photo) qq = request.POST.get("qq", userData.qq) sex = request.POST.get("sex", userData.sex) wechat = request.POST.get("wechat", userData.wechat) currency.models.UserModel.objects.filter(uid=isLogin[2]).update( photo=photo, phone=phone, qq=qq, sex=sex, wechat=wechat, email=email, password=password) status = "修改成功" except: status = "修改失败" userData = currency.models.UserModel.objects.get(uid=isLogin[2]) # 获取信息,记录log information = Information() pageInformation = information.getAll() webLogger(request.META) nav = 'setting' pagetitle = "个人信息" photoFile = [] for evePhoto in range(1, 41): photoFile.append((evePhoto, "/files/userFace/%d.jpg" % (evePhoto))) return render( request, "usercenter/%s/%s" % (information.getValue("templatesUserCenterName"), "infor.html"), locals())
'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'BlogSystem.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases from BlogSystem.information import Information information = Information() DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': information.getValue("mysqlName"), 'USER': information.getValue("mysqlUser"), 'PASSWORD': information.getValue("mysqlPassword"), 'HOST': information.getValue("mysqlHost"), 'PORT': information.getValue("mysqlPort"), 'CONN_MAX_AGE': 600, } } # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators