-
12月12
Vine Linux 5.0 Python CGIを使う
No Comments
色々と足りないのがあるのでインストールします。
※私の環境ではpythonは使える環境にありました。
# apt-get install python
# apt-get install python-devel
# apt-get install python-egenix-mx-base
# apt-get install python-tools
# apt-get install python-setuptools
# apt-get install python-babel
# apt-get install python-genshi
# apt-get install mod_python基本.htaccessを使わないといけなくなるのでhttpd.confには以下の設定に変更しておく。
# vi /etc/apache2/conf/httpd.conf
AllowOverride NoneをAllowOverride FileInfoへ設定# service apache2 restart
PythonをCGIで使う場合文字化けのためかshiftがエラーになったのでUTF-8で書きましょう。
hello.pyをcgiとして動かす場合は下記のような設定を.htaccessへ記述する。
AddHandler mod_python .py
PythonHandler hello
PythonDebug Onhello.pyの内容
from mod_python import apache def handler(req): req.content_type = "text/plain" req.send_http_header() req.write("Hello, World") return apache.OK # end.毎回スクリプトごとに設定してたら気が狂うので下記のような設定方法もあります。
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On慣れないですね^^;
やっぱりPerlが使いやすいかな・・・・・・このページを見た人は下のページも見ています:
- Apache アクセスログ解析AWStats6.95 Vinelinux5.0
- ユーザーディレクトリでCGIを動かす Apache2 正規表現
- Webminのインストール Vine Linux 4.2
- Apache2の基本設定
- mod_layout 5.1 インストール Vine 5.0






COMMENT