« Pardus-linux.org iki yaşında
Yaptığım iş tek bir sürü farklı “markam” var »


Debian üzerinde mod_python yapılandırması

Posted by Bahri Meriç CANLI on Tem 14, 2007

Python öğrenme isteğim tekrar kabarmış olacak ki adı piton olan sunucuma mod_python kurmaya karar verdim. Fakat iş

Code:
sudo apt-get install libapache2-mod-python

demekle bitmiyormuş birazcık apache2.conf ile de oynamak gerekiyor. Bununla ilgili ubuntuforums.org da bir bilgi buldum. Kaybolmasın diye buraya aktarıyorum.

.py betikleri aktif hale getirmek:

Code:
cd /etc/apache2/sites-available/sudo nano 000-default

10. satırdan başlayan aşağıdaki bölümü bulun:

Code:
                Options Indexes FollowSymLinks MultiViews                AllowOverride AuthConfig                Order allow,deny                allow from all                # Uncomment this directive is you want to see apache2’s                # default start page (in /apache2-default) when you go to /                #RedirectMatch ^/$ /apache2-default/        

ve aşağıdaki şekilde değiştirin:

Code:
                Options Indexes FollowSymLinks MultiViews                AllowOverride AuthConfig                Order allow,deny                allow from all

                AddHandler mod_python .py                PythonHandler mod_python.publisher                PythonDebug On

                # Uncomment this directive is you want to see apache2’s                # default start page (in /apache2-default) when you go to /                #RedirectMatch ^/$ /apache2-default/        

Dosyayı kaydedin ve apache2′yi yeniden başlatın:

Code:
sudo /etc/init.d/apache2 restart

Test etmek için:

Code:
sudo nano /var/www/test.py

Aşağıdaki kodu ekleyin:

Code:
def index(req):  return "Test successful";

ve http://localhost/test.py şeklinde çalıştırın ekranda "Test successful" mesajını görüyorsanız mod_python başarı ile yapılandırılmış demektir.

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image



Comment