CentOS 5.5 Apache + Django

    I follow http://library.linode.com/frameworks/django-apache-mod-python/centos-5 to depoly Django on CentOS 5.5 + Apache.

   But It's not so easy for me . My Apache Cfg file is

<VirtualHost x.x.x.x:80>
    ServerName x.x.x.x
    ServerAdmin xxx@gmail.com
    DocumentRoot /var/www/vpn/register

    PythonPath "['/srv/www/vpn/register'] + sys.path"
    <Location "/">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE settings
        PythonDebug Off
    </Location>

    ErrorLog /srv/www/ducklington.org/logs/error.log 
    CustomLog /srv/www/ducklington.org/logs/access.log combined
</VirtualHost>
When I try to access the site, I alway get an error, say can't find module named register.urls. But there is a register.urls in my directory. Finally, I find the  problem is the PythonPath, you should add the parent directory of your project, for example, I Change mine to :
PythonPath "['/srv/www/vpn'] + sys.path"

OK, now I can see my simple web page. Try to add a user, store it in my database. Problems again, "unable to open database file".
The answer can be find here,  http://code.djangoproject.com/wiki/NewbieMistakes#DjangosaysUnabletoOpenDatabaseFilewhenusingSQLite3
     Just, Chmod 777 xxx    ^-^

0 评论: