Linux + Apache + MySQL 环境下OSQA部署(2)

DATABASE_NAME = 'osqa'
DATABASE_USER = 'osqa'
DATABASE_PASSWORD = 'your_osqa_password'
DATABASE_ENGINE = 'mysql'

 

同样在settings_local.py文件中,修改以下这项,来更新域名。

APP_URL = ''

9.  为OSQA数据库建表

输入如下命令,会自动建立必须的表

sudo python manage.py syncdb --all

进行这步操作时,出现错误cannot import name mark_safe,解决方法,打开文件/home/neil/osqa-server/forum/utils/html.py,找到第6行,做如下修改。

#from django.template import mark_safe #原始代码
from django.utils.safestring import mark_safe #修改后

在稍后部署后访问页面出现http 500错误,查看错误日志/var/log/apache2/osqa.error.log,发现该错误url(r'^%s(.*)' % _('nimda/'), admin.site.root),据stackoverflow上的说法,打开/home/neil/osqa-server/forum/urls.py文件,找到第23行,这是django1.0版本的代码,在django1.3版本下不工作。替换成如下代码。

#url(r'^%s(.*)' % _('nimda/'), admin.site.root), #原始代码
url(r'^%s(.*)' % _('nimda/'), include(admin.site.urls)), #修改后

在建完表后,系统会要求建立一个超级管理员帐号,OSQA官网推荐说此时不建立该帐号,等网站架设起来后,通过正常方法建立的第1个用户默认就是超级管理员。

接下来还有一步,不是很了解,原文如下。

With that command you have successfully defined the schema. With South installed, you also have the ability to migrate between databases--a useful feature as OSQA is updated. However, as this is a fresh install, you will need to convince South that the schema is already up to date by "faking" a migration. You can do that with the following command:

sudo python manage.py migrate forum --fake

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/pswdd.html