博客評論系統現狀:css
2017.5.1 update:新增微信審覈評論的方法,見:微信審覈開源評論系統 Isso 的評論html
官網 https://posativ.org/isso/
Github https://github.com/posativ/isso/node
節選並翻譯自官方文檔:https://posativ.org/isso/docs/install/python
要求:linux
Debian/Ubuntu 系統:git
~> sudo apt-get install python-dev sqlite3 build-essential
對於 Fedora/Centos 系統 :github
~> sudo yum install python-devel sqlite ~> sudo yum groupinstall "Development Tools"
注:這個 Development Tools
我沒有安裝成功,可是沒影響sql
~> pip install isso
ordocker
~> easy_install isso
注:我是用 Python 2 安裝的,在 Python 3 上面報 sqlite3 的錯誤,無法用。數據庫
注:上述方法我沒有實驗
要求:
克隆倉庫:
~> 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/ ; 評論通知,使用 smtp notify = smtp [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
詳情見文檔 https://posativ.org/isso/docs/configuration/client/
<script data-isso="/prefix/" data-isso-css="true" data-isso-lang="ru" data-isso-reply-to-self="false" 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="true" data-isso-avatar-bg="#f0f0f0" data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..." data-isso-vote="true" data-vote-levels="" src="https://zhangnew.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
文檔: https://posativ.org/isso/docs/extras/deployment/
pip install gevent isso -c my.cfg run
安裝 :
~> apt-get install build-essential python-dev ~> pip install uwsgi
配置文件:
[uwsgi] http = :8080 master = true ; set to `nproc` processes = 4 cache2 = name=hash,items=1024,blocksize=32 ; you may change this spooler = /tmp/isso/mail module = isso.run ; uncomment if you use a virtual environment ; virtualenv = /path/to/isso env = ISSO_SETTINGS=/path/to/isso.cfg
運行:
~> mkdir /tmp/isso/mail ~> uwsgi /path/to/uwsgi.ini
注:該方法運行失敗,有一個 status code 報錯。
我如今用的是這種方式,支持 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
見文檔:
sqlite
進入命令行:ATTACH 'comments.db' as isso; SELECT id,author,text from isso.comments; DELETE FROM isso.comments WHERE id=87;
轉載自個人博客 https://zhangnew.com