忍者ブログ
[336]  [335]  [334]  [333]  [332]  [329]  [328]  [327]  [326]  [325]  [324
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

・RaspberypiでガーデンIot その3 web環境の生成 cgiserver


・cgiserver.py
import http.server
import sys
try:
  server_address = ("", 8000)
  handler_class = http.server.CGIHTTPRequestHandler #1 ハンドラを設定
  server = http.server.HTTPServer(server_address, handler_class)
  server.serve_forever()
except KeyboardInterrupt:
  sys.exit()  

・cgiserverの起動
sudo pyhton3 -m cgiserver.py

・cgiディレクトの作成 (cgiserverの規定値)
 /home/piの下にcgi-binを作成する

・sencer.htmlの作成

<html>
<head>
<title>Python3 CGI test1</title>
</head>
<body>
<h1>Python3 CGI sencer</h1><hr><p>
<form name = "Form1" method="POST" action="/cgi-bin/sencerdsp.py">
ymd: <input type="text" size=30 name="ymd"><p>
<input type="submit" value="送信" name="button1"><p>
</form>
</body>
</html>

・起動は
 http://localhost:8000/sencer.html
   ipアドレスでも可能



拍手

PR
カレンダー
03 2025/04 05
S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
フリーエリア
最新CM
[03/10 DORA]
最新TB
プロフィール
HN:
dorabu
性別:
非公開
バーコード
ブログ内検索
P R
Copyright © ドラブーのアンドロイドとIoTなブログ All rights reserved. / Template by 四季. / Material by てんせん.

忍者ブログ [PR]