An error of AssertionError: 404! = 200 occurs in the test code. When actually starting and accessing, the character (haaaaaaa) is displayed and the title is changed to kaaa.
However, it didn’t work perfectly and I failed to give css. I don’t know if these two phenomena are the same cause. I want to know the cause.
test code
def test_testtem_view(self):
response = self.client.get(self.test_tem_url)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'test_tem2.html')
view code + html
def test_tem(request):
my_dict={"title":"kaaa"}
return render(request,'test_tem2.html',my_dict)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title>
</head>
<body>
<p>haaaaaaaaaaaaaa</p>
</body>
</html>
Code that adapts css for the time being This should not be wrong
<link rel="stylesheet" href="{% static 'css/test_tem.css' %}">
Invalid block tag on line 8: 'static'. Did you forget to register or load this tag?