質問編集履歴

5

2018/06/30 03:04

投稿

kassymoto
kassymoto

スコア13

test CHANGED
@@ -1 +1 @@
1
- Heroku(python)でのHTMLのページ移動
1
+ Heroku(python)でのHTMLのページ移動
test CHANGED
@@ -91,3 +91,9 @@
91
91
  reader = csv.reader(f)
92
92
 
93
93
  for row in reader:...
94
+
95
+
96
+
97
+ ###原因
98
+
99
+ CSVファイルの中身がいけなかったみたいで、いったん作り直したらうまくいきました。

4

2018/06/30 03:04

投稿

kassymoto
kassymoto

スコア13

test CHANGED
File without changes
test CHANGED
@@ -81,3 +81,13 @@
81
81
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 314: invalid start byte
82
82
 
83
83
  10.171.115.37 - - [30/Jun/2018 02:32:29] "GET /post HTTP/1.1" 500 774
84
+
85
+
86
+
87
+ 上記では省略しているのですが、def push():内でCSVからデータを読み込んでいるのですが、そこでエラーが発生しているみたいです。
88
+
89
+ with open('./data.csv', 'r') as f:
90
+
91
+ reader = csv.reader(f)
92
+
93
+ for row in reader:...

3

heroku error

2018/06/30 02:45

投稿

kassymoto
kassymoto

スコア13

test CHANGED
File without changes
test CHANGED
@@ -71,3 +71,13 @@
71
71
  def push():
72
72
 
73
73
  return template("push")
74
+
75
+
76
+
77
+ ###Heroku logs
78
+
79
+ (result, consumed) = self._buffer_decode(data, self.errors, final)
80
+
81
+ UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 314: invalid start byte
82
+
83
+ 10.171.115.37 - - [30/Jun/2018 02:32:29] "GET /post HTTP/1.1" 500 774

2

プログラム追加

2018/06/30 02:38

投稿

kassymoto
kassymoto

スコア13

test CHANGED
File without changes
test CHANGED
@@ -63,3 +63,11 @@
63
63
  def push:
64
64
 
65
65
  return redirect("/push")
66
+
67
+
68
+
69
+ @route("/push")
70
+
71
+ def push():
72
+
73
+ return template("push")

1

簡単なコードの追加

2018/06/30 02:28

投稿

kassymoto
kassymoto

スコア13

test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,49 @@
17
17
  これをHeroku上で動かすとhttp://localhost:8080にあたるhttps://hogehoge.herokuapp.com/は表示できたのですが、ボタンを押してhttp://localhost:8080/pushにあたるページ
18
18
 
19
19
  https://hogehoge.herokuapp.com/pushに遷移すると、Internal Server Errorが発生してしまいます。
20
+
21
+
22
+
23
+ ファイル構造
24
+
25
+
26
+
27
+ root/
28
+
29
+  ├ hoge.py
30
+
31
+  ├ views/
32
+
33
+  │ └ index.html
34
+
35
+  │ └ push.html
36
+
37
+
38
+
39
+
40
+
41
+ ###コード概要
42
+
43
+ //hoge.py
44
+
45
+
46
+
47
+ 最初はここにルーティングされ、ここでは正常に動作しています。
48
+
49
+ @route("/")
50
+
51
+ def index():
52
+
53
+ return template("index")
54
+
55
+
56
+
57
+ index.html内でボタンを押した場合ここにルーティングします。
58
+
59
+ その際にhttps://hogehoge.herokuapp.com/pushでInternal Server Errorが発生してしまいます。
60
+
61
+ @route("/push", method=["POST"])
62
+
63
+ def push:
64
+
65
+ return redirect("/push")