Django on Apache using mod_python
Install Ubuntu-Server
sudo apt-get install libapache2-mod-python python-django python-django-doc
sudo vim /etc/apache2/sites-available/django-example
<Location "/mysite">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/jack'] + sys.path"
</Location>
Alias /media /usr/share/pyshared/django/contrib/admin/media/
<Location "/media/">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png)$">
SetHandler None
</LocationMatch>
sudo a2dissite default
sudo a2ensite django-example
sudo /etc/init.d/apache2 reload
Django 1.3 apache 配置文件:
<VirtualHost *:80>
ServerName www.qibar.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE qibar.settings
PythonDebug On
PythonPath "['/home/zhaozhigang'] + sys.path"
</Location>
Alias /static /home/zhaozhigang/static
<Location "/static/">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png)$">
SetHandler None
</LocationMatch>
</VirtualHost>