def setUp(self): self.api = Api()
from django.contrib.auth import authenticate, login as auth_login from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from sklearn.metrics.pairwise import linear_kernel from sklearn.feature_extraction.text import TfidfVectorizer # from django.shortcuts import HttpResponse import pandas as pd from matplotlib import pyplot as plt from Collab_Filter import data2, indices, cosine_sim, movies_list import pytvmaze import numpy as np tvm = pytvmaze.TVMaze() from tvmaze.api import Api api = Api() def mainpage(response): return render(response, "main/login_init.html", {}) # Authenticate here def login(request): if request.method == 'POST': form = LogInForm(request.POST or None) if form.is_valid(): username = User.objects.get(email=form.cleaned_data['username']) password = form.cleaned_data['password'] user = authenticate(username=username, password=password) if user: