<commit_before># -*- coding:utf-8 -*-
# from django.shortcuts import render_to_response
from django.shortcuts import render
# from django.template import RequestContext
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
# from django.http import HttpResponseRedirect
# from django.urls import reverse


# Create your views here.
def home(request):
	# return render_to_response("home/index.html", locals(), context_instance=RequestContext(request))
	# return render_to_response("home/index.html")
	return render(request, "home/index.html", locals())

def authnow(WaideRequest):
	name = WaideRequest.POST.get('username')
	pswd = WaideRequest.POST.get('password')
	user = authenticate(username=name, password=<PASSWORD>)
	userbkinfo = {"name" : name, "status" : ""}
	if user is not None:
		login(WaideRequest, user)
		userbkinfo["status"] = "success"
		# return render_to_response("home/index.html")
	else:
		userbkinfo["status"] = "failure"
	return userbkinfo;

def log_me_in(request):
	userbkinfo = authnow(request)
	return JsonResponse(userbkinfo)

@login_required
def log_me_out(request):
	logout(request)
	return JsonResponse({"status" : True})

def log_Page(request):
	return render(request, "home/login.html", locals())

def loginFull(request):
	userbkinfo = authnow(request)
	return render(request, "home/login.html", locals())
	# return HttpResponseRedirect(reverse('home:login_Form', args=(userbkinfo,)))

@login_required
def loadAjaxAvatar(request):
	return render(request, "home/loadAjaxAvatar.html", locals())

# def get_language_info_list(request)
# 	from django.conf import settings
# 	LANGUAGES = settings.LANGUAGES
# 	return render(request, "home/index.html", locals())

# @login_required
# def pertest(request):
# 	return JsonResponse({"apple" : "iphone 6S plus 土豪金限量抢购大狂欢只要998电视砸烂抱回家"})<commit_msg>connect database and return query result<commit_after># -*- coding:utf-8 -*-
# from django.shortcuts import render_to_response
from django.shortcuts import render
from django.shortcuts import get_object_or_404
# from django.template import RequestContext
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
# from django.http import HttpResponseRedirect
# from django.urls import reverse

# Databases
from .models import SiteKV


# Create your views here.



def home(request):
	# return render_to_response("home/index.html", locals(), context_instance=RequestContext(request))
	# return render_to_response("home/index.html")
	recNum = get_object_or_404(SiteKV, key="recNum").value
	return render(request, "home/index.html", locals())

def authnow(WaideRequest):
	name = WaideRequest.POST.get('username')
	pswd = WaideRequest.POST.get('password')
	user = authenticate(username=name, password=<PASSWORD>)
	userbkinfo = {"name" : name, "status" : ""}
	if user is not None:
		login(WaideRequest, user)
		userbkinfo["status"] = "success"
		# return render_to_response("home/index.html")
	else:
		userbkinfo["status"] = "failure"
	return userbkinfo;

def log_me_in(request):
	userbkinfo = authnow(request)
	return JsonResponse(userbkinfo)

@login_required
def log_me_out(request):
	logout(request)
	return JsonResponse({"status" : True})

def log_Page(request):
	recNum = get_object_or_404(SiteKV, key="recNum").value
	return render(request, "home/login.html", locals())

def loginFull(request):
	userbkinfo = authnow(request)
	recNum = get_object_or_404(SiteKV, key="recNum").value
	return render(request, "home/login.html", locals())
	# return HttpResponseRedirect(reverse('home:login_Form', args=(userbkinfo,)))

@login_required
def loadAjaxAvatar(request):
	return render(request, "home/loadAjaxAvatar.html", locals())

# def get_language_info_list(request)
# 	from django.conf import settings
# 	LANGUAGES = settings.LANGUAGES
# 	return render(request, "home/index.html", locals())

# @login_required
# def pertest(request):
# 	return JsonResponse({"apple" : "iphone 6S plus 土豪金限量抢购大狂欢只要998电视砸烂抱回家"})
{'fraction_non_alphanumeric': 0.12351371026449891, 'fraction_numerical': 0.005338510070371269, 'mean_word_length': 6.633333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7168464', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1356, 'n_words': 300}