質問編集履歴
5
s
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Heroku(python)でのHTMLのページ移動
|
1
|
+
sHeroku(python)でのHTMLのページ移動
|
body
CHANGED
@@ -44,4 +44,7 @@
|
|
44
44
|
上記では省略しているのですが、def push():内でCSVからデータを読み込んでいるのですが、そこでエラーが発生しているみたいです。
|
45
45
|
with open('./data.csv', 'r') as f:
|
46
46
|
reader = csv.reader(f)
|
47
|
-
for row in reader:...
|
47
|
+
for row in reader:...
|
48
|
+
|
49
|
+
###原因
|
50
|
+
CSVファイルの中身がいけなかったみたいで、いったん作り直したらうまくいきました。
|
4
あ
title
CHANGED
File without changes
|
body
CHANGED
@@ -39,4 +39,9 @@
|
|
39
39
|
###Heroku logs
|
40
40
|
(result, consumed) = self._buffer_decode(data, self.errors, final)
|
41
41
|
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 314: invalid start byte
|
42
|
-
10.171.115.37 - - [30/Jun/2018 02:32:29] "GET /post HTTP/1.1" 500 774
|
42
|
+
10.171.115.37 - - [30/Jun/2018 02:32:29] "GET /post HTTP/1.1" 500 774
|
43
|
+
|
44
|
+
上記では省略しているのですが、def push():内でCSVからデータを読み込んでいるのですが、そこでエラーが発生しているみたいです。
|
45
|
+
with open('./data.csv', 'r') as f:
|
46
|
+
reader = csv.reader(f)
|
47
|
+
for row in reader:...
|
3
heroku error
title
CHANGED
File without changes
|
body
CHANGED
@@ -34,4 +34,9 @@
|
|
34
34
|
|
35
35
|
@route("/push")
|
36
36
|
def push():
|
37
|
-
return template("push")
|
37
|
+
return template("push")
|
38
|
+
|
39
|
+
###Heroku logs
|
40
|
+
(result, consumed) = self._buffer_decode(data, self.errors, final)
|
41
|
+
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 314: invalid start byte
|
42
|
+
10.171.115.37 - - [30/Jun/2018 02:32:29] "GET /post HTTP/1.1" 500 774
|
2
プログラム追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -30,4 +30,8 @@
|
|
30
30
|
その際にhttps://hogehoge.herokuapp.com/pushでInternal Server Errorが発生してしまいます。
|
31
31
|
@route("/push", method=["POST"])
|
32
32
|
def push:
|
33
|
-
return redirect("/push")
|
33
|
+
return redirect("/push")
|
34
|
+
|
35
|
+
@route("/push")
|
36
|
+
def push():
|
37
|
+
return template("push")
|
1
簡単なコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,27 @@
|
|
7
7
|
http://localhost:8080/pushといった感じにページ遷移するようになっています。
|
8
8
|
|
9
9
|
これをHeroku上で動かすとhttp://localhost:8080にあたるhttps://hogehoge.herokuapp.com/は表示できたのですが、ボタンを押してhttp://localhost:8080/pushにあたるページ
|
10
|
-
https://hogehoge.herokuapp.com/pushに遷移すると、Internal Server Errorが発生してしまいます。
|
10
|
+
https://hogehoge.herokuapp.com/pushに遷移すると、Internal Server Errorが発生してしまいます。
|
11
|
+
|
12
|
+
ファイル構造
|
13
|
+
|
14
|
+
root/
|
15
|
+
├ hoge.py
|
16
|
+
├ views/
|
17
|
+
│ └ index.html
|
18
|
+
│ └ push.html
|
19
|
+
|
20
|
+
|
21
|
+
###コード概要
|
22
|
+
//hoge.py
|
23
|
+
|
24
|
+
最初はここにルーティングされ、ここでは正常に動作しています。
|
25
|
+
@route("/")
|
26
|
+
def index():
|
27
|
+
return template("index")
|
28
|
+
|
29
|
+
index.html内でボタンを押した場合ここにルーティングします。
|
30
|
+
その際にhttps://hogehoge.herokuapp.com/pushでInternal Server Errorが発生してしまいます。
|
31
|
+
@route("/push", method=["POST"])
|
32
|
+
def push:
|
33
|
+
return redirect("/push")
|