安裝:
apt-get install -y mysql-server apache2 libapache2-mod-python python-mysqldb python-django
下面這些暫時沒裝
xfsprogs python-imaging subversion php5 phpmyadmin
也可以源碼安裝:
setuptools-0.6c11.tar.gz
./setup.py install 安裝setuptools後
再安裝MySQL-python,Django-1.3.1
python setup.py install
MySQL-python-1.2.3.tar.gz
Django-1.3.1.tar.gz
配置:
cd /etc/apache2vi httpd.conf
添加
<Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE myproject.settings PythonOption django.root /myproject PythonDebug On PythonPath "['/var/www'] + sys.path"</Location>
Alias /adm_media/ /usr/lib/pymodules/python2.7/django/contrib/admin/media/<Location "/adm_media/"> SetHandler None</Location>
Alias /files/ /var/www/myproject/files/<Location "/files/"> SetHandler None</Location>
重啟apache2:
/etc/init.d/apache2 restart
參考:
http://codespatter.com/2008/10/15/setting-up-apache2-mod_python-mysql-and-django-on-debian-lenny-or-ubuntu-hardy-heron/
http://fosswire.com/post/2008/05/installing-mod_python-and-django-on-apache/