Debian Lenny üstüne Django kurulumu
tarih 04. Eyl, 2009 yazar admin in Debian, Linux server
Bu bölüm Debian Lenny sunucuya Django yüklemeyi anlatıyor. Django hızlı pyhon ile web uygulamaları geliştirmeye olanak sağlayan bir web frame. Kurulumu Apache ve mod_pyhon ile kulanacağım.
1. MySQL Kurulumu
aptitude install mysql-server mysql-clientburda yeni sql root şifresi oluşturacağız.
New password for the MySQL “root” user: <<Sizinrootşifreniz
Repeat password for the MySQL “root” user: <<Sizinrootşifreniz
bind-address ekliyoruz 127.0.0.1
vi /etc/mysql/my.cnfaçılan pencerede şunu ekliyoruz
[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
[...]
MySQL i yeniden başlatıyoruz.
/etc/init.d/mysql restart
şimdi network kontrolu çalışytıyoruz.
netstat -tap | grep mysql
aşağıdaki gibi bir çıktı alacaksınız.
server1:~# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 3403/mysqld
server1:~#
2 Apache ve mod_python Kurulumu
aptitude install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-python
3 Django Kurulumu
aptitude install python-django python-mysqldb
4 Apache Konfigrasyonu
django apache ile ilgili genel detaylara şuradan bakabilirsiniz
http://www.djangoproject.com/documentation/tutorial01/
mkdir /home/mycode
cd /home/mycode
/usr/share/python-support/python-django/django/bin/django-admin.py startproject mysite
sanal hostu kurduktan sonra.
vi /etc/apache2/sites-available/default
aşağıdaki kodu ekliyoruz.
[...]
<Location “/mysite”>
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath “['/home/mycode'] + sys.path”
</Location>
[...]
apache’yi yeniden başlatıyoruz.
/etc/init.d/apache2 restart
şimdi http://www.example.com/mysite girip deneyebiliriz.
5 MySQL Database Bağlanma
mysql -u root -pgerekli ayarları yapıyoruz.
[...]
DATABASE_ENGINE = ‘mysql’ # ‘postgresql_psycopg2′, ‘postgresql’, ‘mysql’, ’sqlite3′ or ‘oracle’.
DATABASE_NAME = ‘mysite’ # Or path to database file if using sqlite3.
DATABASE_USER = ‘mysiteadmin’ # Not used with sqlite3.
DATABASE_PASSWORD = ‘mysiteadmin_password’ # Not used with sqlite3.
DATABASE_HOST = ” # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ” # Set to empty string for default. Not used with sqlite3.
[...]
işlem tamamdır. .. Django kurulumu gerçekleştirilmiştir

