代码改变世界

debian apache django

2014-08-18 16:24  boyjump  阅读(161)  评论(0)    收藏  举报

1 安装apache2:apt-get install apache2 apt-get install apache2-dev

2 安装mod_wsgi:pip install mod_wsgi 

3 修改apache配置文件 类似:

<VirtualHost *:80>
    ServerName wsgi.mytest
    DocumentRoot /home/sarlmolapple/workspace/django-site/mytest
    <Directory /home/sarlmolapple/workspace/django-site/mytest>
        Order allow,deny
        Allow from all
    </Directory>
   WSGIScriptAlias / /home/sarlmolapple/workspace/django-site/mytest/wsgi.py
</VirtualHost>
4 修改wsgi.py
import os
import sys
 
sys.path.append('/home/sarlmolapple/workspace/django-site')
sys.path.append('/home/sarlmolapple/workspace/django-site/mytest')

 注意:

sqlite3访问 要更改 数据库所在文件夹 和数据库文件的属性

chown www-data folder

chown www-data folder/db.sqlite3