質問編集履歴
3
整形
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,6 +67,7 @@
|
|
67
67
|
# できましたー(≧∀≦)
|
68
68
|
siruku6さまの以下の一言
|
69
69
|
> ソースを見たのですが、{% block %} と {% endblock %}は、そこにはいらなかったような気がします
|
70
|
+
|
70
71
|
`test.html`には当てはめたのですが、`base_wordforms.html`には当てはめず「`{% block verb0 %}{% endblock %}`で。。。えっと0の所はどう変数を持ってこようか?」などと考えていました。とりあえず夜も遅いしベッドに入って目が覚めてO'Reillyの読み放題サービスで、[Flask Framework Cookbook: Over 80 proven recipes and techniques for Python web development with Flask, 2nd Edition](https://amzn.to/2n6W3yD) と[Flask By Example by Gareth Dwyer(2016-03-31)](https://amzn.to/2n4NQuQ) を行ったり来たり、siruku6さまに言われたことを考えつついろいろ脳内シミュレーションして「もしかしたら`base_wordforms.html`はブロックなしでシンプルに`{{ verb[0] }}`なんて書けばいいんじゃない?」ということに思い至りそれで試したらうまくいきました:D
|
71
72
|
|
72
73
|
学んだこと
|
2
問題解決報告
title
CHANGED
File without changes
|
body
CHANGED
@@ -62,4 +62,16 @@
|
|
62
62
|
ファイルの場所
|
63
63
|
- app.py (ルートディレクトリ)
|
64
64
|
- templates/base_wordforms.html
|
65
|
-
- templates/test.html
|
65
|
+
- templates/test.html
|
66
|
+
|
67
|
+
# できましたー(≧∀≦)
|
68
|
+
siruku6さまの以下の一言
|
69
|
+
> ソースを見たのですが、{% block %} と {% endblock %}は、そこにはいらなかったような気がします
|
70
|
+
`test.html`には当てはめたのですが、`base_wordforms.html`には当てはめず「`{% block verb0 %}{% endblock %}`で。。。えっと0の所はどう変数を持ってこようか?」などと考えていました。とりあえず夜も遅いしベッドに入って目が覚めてO'Reillyの読み放題サービスで、[Flask Framework Cookbook: Over 80 proven recipes and techniques for Python web development with Flask, 2nd Edition](https://amzn.to/2n6W3yD) と[Flask By Example by Gareth Dwyer(2016-03-31)](https://amzn.to/2n4NQuQ) を行ったり来たり、siruku6さまに言われたことを考えつついろいろ脳内シミュレーションして「もしかしたら`base_wordforms.html`はブロックなしでシンプルに`{{ verb[0] }}`なんて書けばいいんじゃない?」ということに思い至りそれで試したらうまくいきました:D
|
71
|
+
|
72
|
+
学んだこと
|
73
|
+
- `{{}}`にはPythonの変数が入る
|
74
|
+
- `{% block xxx %}{% endblock %}`の`xxx`の部分の名前は同じものを同じページで1回以上つかったらだめ。
|
75
|
+
|
76
|
+
[完成したGitHub](https://github.com/Yukiya025/russianpj)
|
77
|
+
[heroku該当ページ。ちゃんと表示されています^^v](https://russianpj.herokuapp.com/testverb)
|
1
GitHub追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,4 +51,15 @@
|
|
51
51
|
```
|
52
52
|
# エラー文
|
53
53
|
jinja2.exceptions.TemplateSyntaxError: expected token 'name', got '{'
|
54
|
-
```
|
54
|
+
```
|
55
|
+
|
56
|
+
# いろいろいじってみたが。。。?
|
57
|
+
エラーが出続けて眠いのでギブアップorz 惜しいような気がするが堂々巡り。
|
58
|
+
問題は`{% block xxx %}` の扱い方のようで`jinja2.exceptions.TemplateSyntaxError: unexpected '%'とか'+'`云々と出てきて治してもエラーが出続ける。
|
59
|
+
|
60
|
+
[GitHubに上げました](https://github.com/Yukiya025/russianpj)
|
61
|
+
|
62
|
+
ファイルの場所
|
63
|
+
- app.py (ルートディレクトリ)
|
64
|
+
- templates/base_wordforms.html
|
65
|
+
- templates/test.html
|