一直受mod_python缓存的困扰,所以想尝试使用一下mod_wsgi,以下记录的是大概的步骤:

首先ln -s /var/www/virtualhost/项目名 /usr/lib/python2.6/site-packages/项目名

<VirtualHost *:80>
        ServerName pinzui.com

        WSGIScriptAlias / /var/www/virtualhost/项目名/wsgi/项目名.wsgi
        
        <Directory /var/www/virtualhost/项目名>
                Order allow,deny
                Allow from all
        </Directory>

        Alias /static "/var/www/virtualhost/项目名/static"
        <Directory "/var/www/virtualhost/项目命/static">
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

在项目下面创建 wsgi/项目名.wsgi
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'yanchuang.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
就ok了

另外发现
ln -s  /usr/local/lib/python2.6/site-packages/
项目名 -> /data/www/项目名
做link可以把这个项目当成python的lib使用