开源评论系统 Isso 全攻略
文章目录
(本文写于 2017 年初,更新于 2020 年)
博客评论系统现状:
- 多说已经倒闭了,将于 2017.6.31 结束服务
- Disqus 国内非常不稳定,虽然用了一段时间,但是发现最近好像有广告了,有很多乱七八糟的请求。
- 畅言估计和多说差不了多少,没看到赢利点。
- 网易云跟帖,不能设置昵称,不能匿名评论,加了官方群,都是提问的,管理员不作为。
- 然后就找到了这个开源的评论系统:Isso
2020-03-22 更新:最近又看了下新版本(源码安装),有了很多新特性:
- 支持邮件通知,每个评论都发给管理员,评论者可以接收别人回复自己的评论;
- 支持 Gravatar 头像显示(支持使用CDN镜像,你懂的),或者随机头像;
- 支持 MarkDown;
- 后台审核管理功能;
- 对评论进行<顶>/<踩>;
- Python 3
2017-05-01 更新:新增微信审核评论的方法,见:微信审核开源评论系统 Isso 的评论
官网 https://posativ.org/isso/
Github https://github.com/posativ/isso/
安装
节选并翻译自官方文档:https://posativ.org/isso/docs/install/
使用 pip 安装
要求:
- Python 2.6, 2.7 or 3.3+ (+ devel headers)
- SQLite 3.3.8 +
- C 编译器
先安装 python 和依赖
Debian/Ubuntu 系统:
~> sudo apt-get install python-dev sqlite3 build-essential对于 Fedora/Centos 系统 :
~> sudo yum install python-devel sqlite
~> sudo yum groupinstall "Development Tools"注:这个 Development Tools 我没有安装成功,但是没影响
安装 Isso
~> pip install isso
or
~> easy_install isso 注:我是用 Python 2 安装的,在 Python 3 上面报 sqlite3 的错误,没法用。
使用操作系统的包管理器安装
- Debian: https://packages.crapouillou.... – built from PyPi. Includes startup scripts and vhost configurations for Lighttpd,
Apache and Nginx [source]. #729218 is an ITP for Debian. - Gentoo: http://eroen.eu/cgit/cgit.cgi... – not yet available in Portage, but you can use the ebuild to build Isso.
- Arch Linux: https://aur.archlinux.org/pac... – install with yaourt isso.
- Fedora: https://copr.fedoraproject.or... — copr repository. Built from Pypi, includes a systemctl unit script.
- Docker Image: https://registry.hub.docker.c...
注:上述方法我没有实验
从源码安装
要求:
- Python 2.6, 2.7 or 3.3+ (+ devel headers)
- Virtualenv
- SQLite 3.3.8 or later
- a working C compiler
- Node.js, NPM and Bower(安装 nodejs 后 可以使用 npm 安装 Bower)
克隆仓库:
~> git clone https://github.com/posativ/isso.git
~> cd isso/注:截止2017.3.30,最新版为 0.10.7-dev ,经测试没法用,各种404。后来从 github Release 下载的 0.10.5 和 0.10.6 均正常。
创建一个虚拟环境(推荐,我没用,我用的 pyenv):
~> virtualenv .
~> source ./bin/activate安装 Isso 及其依赖:
~> python setup.py develop # or `install`
~> isso run安装 JavaScript 模块:
~> make init优化前的 js:
<script src="/js/config.js"></script>
<script data-main="/js/embed" src="/js/components/requirejs/require.js"></script>压缩 js:
~> npm install -g requirejs uglify-js jade
~> make js配置
服务端配置
详情见文档 https://posativ.org/isso/docs/configuration/server/
自己编写一个配置文件 : isso.conf
[general]
; 数据库位置,注意检查权限,如果没有会自动创建。
dbpath = /var/lib/isso/comments.db
; 博客的地址,可以添加多个,比如 http 和 https
host =
http://localhost:4000/
http://zhangnew.com/
https://zhangnew.com/
; 评论通知 for 管理员,使用 smtp
notify = smtp
; 通知用户,smtp 发邮件
reply-notifications = true
[server]
; 监听的地址和端口 : 0.0.0.0 代表任何人可以访问
listen = http://0.0.0.0:8001/
[smtp]
username =
password =
host = smtp.mxhichina.com
port = 25
security = none
to =
from =
timeout =
[guard]
enabled = true
ratelimit = 2
; 评论数量限制
direct-reply = 30
; 是否允许回复自己
reply-to-self = true
; 是否必须填写作者
require-author = false
; 是否必须填写邮箱
require-email = false
; 是否开启审核,true 是开启,30d 表示删除 30 天没有通过审核的评论
[moderation]
enabled = false
purge-after = 30d
; 启用后台管理系统,访问地址 isso_url/admin
[admin]
enabled = true
password = your_password客户端配置
详情见文档 https://posativ.org/isso/docs/configuration/client/
<script data-isso="https://your-domain.com"
data-isso-css="true"
data-isso-lang="zh"
data-isso-reply-notifications="true"
data-isso-reply-to-self="true"
data-isso-require-author="false"
data-isso-require-email="false"
data-isso-max-comments-top="10"
data-isso-max-comments-nested="5"
data-isso-reveal-on-click="5"
data-isso-avatar="false"
data-isso-gravatar="true"
data-isso-vote="true"
data-vote-levels=""
src="https://your-domain.com/js/embed.js"></script>使用
导入 Disqus 或 Wordpress 的评论,这一点很好。可怜了多说用户。
isso -c /path/to/isso.conf import disqus-or-wordpress.xml运行命令:
isso -c /path/to/isso.conf run部署
gunicorn
我现在用的是这种方式,支持 https
$ pip install gunicorn运行:
$ export ISSO_SETTINGS="/path/to/isso.cfg"
$ gunicorn -b 0.0.0.0:8001 -w 4 --certfile=certificate.crt --keyfile=private.key --preload isso.run其他部署方式
见官方文档:
- mod_wsgi
- uWSGI
- gevent
- mod_fastcgi
- Openshift
优缺点
优点
- 自己对评论系统有完全的控制权.
- 暂时没发现有机器人发送垃圾评论.
- 有后台管理系统.
缺点
- 邮件通知只有英文,已有人提交 pull request,还没合并。
- 只支持 2 级评论回复。
不支持回复评论时通知评论作者, Isso 的作者在考虑要不要 merge 这个 pull request。已经支持。avatar 头像不能关联 gravatar.com 的头像。已经支持。- 已有后台管理系统。
评论不好管理,常规方法可以通过邮件提醒里面的链接来删除评论。非常规方法就要修改数据库了,sqlite进入命令行:
ATTACH 'comments.db' as isso;
SELECT id,author,text from isso.comments;
DELETE FROM isso.comments WHERE id=87;
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论