回答編集履歴
2
リンク修正
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[title = div.h2 を soup.find('h2').get_text() に変更するとraise TemplateNotFound(template)が発生する理由]
|
2
2
|
|
3
3
|
上記の~.pyファイルと同じフォルダにtemplateフォルダを作り、その中にindex.htmlとlayout.htmlを作成していないからではないでしょうか。
|
4
|
-
(index.htmlの中身は[ここ](https://github.com/alumi-mic/flasksample-hatebu/blob/master/templates/
|
4
|
+
(index.htmlの中身は[ここ](https://github.com/alumi-mic/flasksample-hatebu/blob/master/templates/index.html)、
|
5
5
|
layout.htmlの中身は[ここ](https://github.com/alumi-mic/flasksample-hatebu/blob/master/templates/layout.html)の通りになっている必要があります)
|
6
6
|
|
7
7
|
あと、(templateフォルダおよびその中にindex.html、layout.htmlを作成したうえで)
|
1
修正
answer
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
(index.htmlの中身は[ここ](https://github.com/alumi-mic/flasksample-hatebu/blob/master/templates/layout.html)、
|
5
5
|
layout.htmlの中身は[ここ](https://github.com/alumi-mic/flasksample-hatebu/blob/master/templates/layout.html)の通りになっている必要があります)
|
6
6
|
|
7
|
-
あと、
|
7
|
+
あと、(templateフォルダおよびその中にindex.html、layout.htmlを作成したうえで)
|
8
8
|
title = div.h2 を soup.find('h2').get_text()
|
9
9
|
とする必要はなく、
|
10
10
|
title = div.h3
|
11
|
-
とす
|
11
|
+
とすれば、元のAttributeError: 'NoneType' object has no attribute 'getText'エラーは
|
12
12
|
発生しなくなると思います。
|
13
13
|
|
14
14
|
|