teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

edit

2018/03/15 14:01

投稿

mkgrei
mkgrei

スコア8562

answer CHANGED
@@ -2,4 +2,24 @@
2
2
 
3
3
  https://qiita.com/utgwkk/items/318985b16337548f4f07
4
4
 
5
- やりたいことの意図がわからないので、的外れかもしれませんが。
5
+ やりたいことの意図がわからないので、的外れかもしれませんが。
6
+
7
+ ---
8
+
9
+ https://anopara.net/2013/12/11/ubuntulubuntu13-04でpythonwsgiapacheのhelloworld/
10
+
11
+ `index.cgi`
12
+ ```python
13
+ #!/home/ユーザーID/.pyenv/versions/3.4.2/bin/python
14
+ from wsgiref.handlers import CGIHandler
15
+
16
+ def application(environ, start_response):
17
+ status = '200 OK'
18
+ output = 'Hello World!\n'
19
+ response_headers = [('Content-type', 'text/plain'),
20
+ ('Content-Length', str(len(output)))]
21
+ start_response(status, response_headers)
22
+ return [output]
23
+
24
+ CGIHandler().run(application)
25
+ ```