私は電子工作系の部活に入っておりLEDキューブを作りました。
それの機能としてラズパイを用いスマホで光らせ方を決められるようにしようとしています。
※うちの部活にはiotできる人がいないのでこうしています(T_T)
DIR
1/home/pi 2/ctrlLED/ 3 -cntrolLED_on_web.py//←これが.pyのあれ 4 -static/ 5 -html/ 6 -index.html//メイン画面 7 -wrong.html//パスワード違った際ここに飛ぶ、画像が表示されるが同じように404吐く 8 -js/Script2.js//.jsのあれ 9 -css/StyleSheet1.css//.cssのあれ
該当のソースコード達
from bottle import route,run,get,template,static_file host = 'localhost' @route('/') @route('/<passward:int>') def index(passward): if passward == 123456789: return template('/home/pi/ctrlLED/static/html/index.html') else: return template('/home/pi/ctrlLED/static/html/wrong.html') @get('./static/html/<filepath:path>') def static(filepath): print("print filepath") print(filepath) return static_file(filepath,root='./static/html') run(host='172.31.2.100', port=85)
index.html
1<!DOCTYPE html> 2 3<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 4<head> 5 <meta charset="utf-8" /> 6 <title>エレ研</title> 7 <link rel="stylesheet" type="text/css" href="static/html/css/StyleSheet1.css"> 8 <script type="text/javascript" src="static/html/js/Script2.js"></script> 9</head> 10<body> 11 <table> 12 <tr> 13 <th>面1</th> 14 <th>x1</th> <th>x2</th> <th>x3</th> <th>x4</th> 15 <th>x5</th> <th>x6</th> <th>x7</th> <th>x8</th> 16 </tr> 17 <tr> 18 <th>y1</th> 19 <td></td> <td></td> <td></td> <td></td> 20 <td></td> <td></td> <td></td> <td></td> 21 22 </tr> 23 <tr> 24 <th>y2</th> 25 <td></td> <td></td> <td></td> <td></td> 26 <td></td> <td></td> <td></td> <td></td> 27 </tr> 28 <tr> 29 <th>y3</th> 30 <td></td> <td></td> <td></td> <td></td> 31 <td></td> <td></td> <td></td> <td></td> 32 </tr> 33 <tr> 34 <th>y4</th> 35 <td></td> <td></td> <td></td> <td></td> 36 <td></td> <td></td> <td></td> <td></td> 37 </tr> 38 <tr> 39 <th>y5</th> 40 <td></td> <td></td> <td></td> <td></td> 41 <td></td> <td></td> <td></td> <td></td> 42 </tr> 43 <tr> 44 <th>y6</th> 45 <td></td> <td></td> <td></td> <td></td> 46 <td></td> <td></td> <td></td> <td></td> 47 </tr> 48 <tr> 49 <th>y7</th> 50 <td></td> <td></td> <td></td> <td></td> 51 <td></td> <td></td> <td></td> <td></td> 52 </tr> 53 <tr> 54 <th>y8</th> 55 <td></td> <td></td> <td></td> <td></td> 56 <td></td> <td></td> <td></td> <td></td> 57 </tr> 58 </table> 59</body> 60</html>
ctrlLEDJS.js
1/*できてない、HTMLで表を作ってマウスでクリックすると色が永久的につくみたいな感じのがやりたい 2サイトを少し見て回ったけどわかりずらかったので、教えていただけるとありがたいです 3*/
table { width: 100px; border: 2px solid black; border-collapse: collapse; background-color:white; } table th{ border: 1px solid black; } table td { border: 1px solid black; text-align: center; padding: 3px 3px; } table td:hover { background-color: rebeccapurple; }
該当のエラーコード
*.*.*.* - - [13/Sep/2019 20:28:43] "GET /123456789 HTTP/1.1" 200 2915 Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run self.finish_response() File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response self.write(data) File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write self.send_headers() File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers self.send_preamble() File "/usr/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble 'Date: %s\r\n' % format_date_time(time.time()) File "/usr/lib/python2.7/socket.py", line 328, in write self.flush() File "/usr/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe *.*.*.* - - [13/Sep/2019 20:28:43] "GET /123456789 HTTP/1.1" 500 59 ---------------------------------------- Exception happened during processing of request from ('*.*.*.*', 53782) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__ self.finish() File "/usr/lib/python2.7/SocketServer.py", line 713, in finish self.wfile.close() File "/usr/lib/python2.7/socket.py", line 283, in close self.flush() File "/usr/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe ---------------------------------------- *.*.*.* - - [13/Sep/2019 20:28:57] "GET /123456789 HTTP/1.1" 200 2915 the filepath css/StyleSheet1.css *.*.*.* - - [13/Sep/2019 20:28:57] "GET /static/html/css/StyleSheet1.css HTTP/1.1" 404 749 the filepath js/Script2.js *.*.*.* - - [13/Sep/2019 20:28:57] "GET /static/html/js/Script2.js HTTP/1.1" 404 743
*は自分のスマホのIPアドレスなので伏せます
一回更新しようとして間違って「クリックすると前に戻ります」してしまったのでがばがばかもしれませんが、ご容赦ください
試したこと
このサイトを参考に変えて、わからないところは他サイトでっていう感じです。
https://teratail.com/questions/130896
補足情報
私はRasberrryPiZeroWを使っていて、開発アプリはPython3(IDLE)とテキストエディターです。
まずないと思いますが、ラズパイのせいでできないという感じならどうすればよいか教えていただきたいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/09/03 22:12
退会済みユーザー
2019/09/05 14:03
退会済みユーザー
2019/09/06 09:10
2019/09/06 10:32
2019/09/06 10:33
退会済みユーザー
2019/09/13 11:24
退会済みユーザー
2019/10/06 06:37