一、nginx/1.1.13 ,Python 2.6.6(系统自带)#略
二、安装python依赖模块
easy_install ElementTree South markdown html5lib python-openid
-----------
三、安装python的 Django框架
tar -zxvf Django-1.3.1.tar.gz
cd Django-1.3.1
python setup.py install
cd ..
-------------
四、解压osqa代码,配置基本运行参数并且修改部分BUG
tar -zxvf fantasy-island-0.9.0-beta3.tar.gz
mv fantasy-island-0.9.0-beta3 osqa
cd osqa
mkdir cache
chmod u+w log forum/upfiles
------------
cp osqa.wsgi.dist osqa.wsgi
修改osqa.wsgi
import os
import sys
sys.path.append('/usr/local/src')
sys.path.append('/usr/local/src/osqa')
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
-----------------
数据库配置
mkdir db
chmod u+w db
cp settings_local.py.dist settings_local.py
修改settings_local.py
DATABASE_NAME = '/usr/local/src/osqa/db/osqa.db'
DATABASE_ENGINE = 'django.db.backends.sqlite3'
TIME_ZONE = 'Asia/Shanghai'
LANGUAGE_CODE = 'zh_CN'
APP_URL = ''
DISABLED_MODULES = ['books', 'recaptcha', 'project_badges', 'oauthauth', 'facebookauth']
修改 settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/usr/local/src/osqa/db/osqa.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
-----------------
修改部分代码BUG
修改 /usr/local/src/osqa/forum/utils/html.py
将 django.template import mark_safe
变更为
from django.utils.safestring import mark_safe
修改 /usr/local/src/osqa/forum/urls.py
url(r'^%s(.*)' % _('nimda/'), admin.site.root),
变更为
url(r'^%s(.*)' % _('nimda/'), include(admin.site.urls)),
----------------------
五、生成数据库文件
python manage.py syncdb --all
python manage.py migrate forum --fake
----------------------
六、启动应用
nohup python manage.py runserver &
-----------------------------
七、Nginx反向代理及虚拟目录设置
location / {
proxy_pass
}
location /m {
root /usr/local/src/osqa/forum/skins/;
}
location /upfiles {
root /usr/local/src/osqa/forum/;
}
cd /usr/local/src/osqa/forum/skins/;ln -s . m #创建软链接,解决web页面上的css文件加载异常的问题。
八、启动Nginx程序
/usr/local/sbin/nginx
打开浏览器访问
阅读(1638) | 评论(0) | 转发(0) |