Debian üzerinde mod_python yapılandırması

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.

Son güncelleme 14 Temmuz 2007

The following two tabs change content below.

Bahri Meriç CANLI

Web Geliştiricisi, Linuxcu, Dağcı, Amatör Telsizci, Girişimci, Motorcu

Latest posts by Bahri Meriç CANLI (see all)