ForeverYoung's blog ยป mercurial/atom/mercurial/?lang=en2011-05-27T10:24:15ZAnton NovosyolovLinux, programming, etc.blohgAbout blohg/post/about-blohg/?lang=en2011-05-27T10:24:15Z2011-05-27T10:24:15ZAnton Novosyolovanton.novosyolov@gmail.com<!-- date: 1306491855 -->
<!-- tags: python,reStructuredText,mercurial,gentoo,lighttpd,blohg -->
<p><a class="reference external" href="http://blohg.org">Blohg</a> is a blog engine written in Python.</p>
<!-- date: 1306491855 -->
<!-- tags: python,reStructuredText,mercurial,gentoo,lighttpd,blohg -->
<p><a class="reference external" href="http://blohg.org">Blohg</a> is a blog engine written in Python.</p>
<!-- read_more -->
<p>It has <a class="reference external" href="http://flask.pocoo.org">Flask</a>, <a class="reference external" href="http://jinja.pocoo.org/2/">Jinja2</a>, <a class="reference external" href="http://pypi.python.org/pypi/docutils">docutils</a>, <a class="reference external" href="http://mercurial.selenic.com">Mercurial</a> in its basis.
Comment system is external, via <a class="reference external" href="http://disqus.com">disqus</a>.</p>
<p>For me it has this advantages:</p>
<ul class="simple">
<li><a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> - it has more capabilities than, for example, <a class="reference external" href="http://ru.wikipedia.org/wiki/Markdown">Markdown</a>.</li>
<li><a class="reference external" href="http://mercurial.selenic.com">Mercurial</a> - It's convinient to post - <em>edit</em>, hg commit, hg push (but there's no capability to post from browser <em>yet</em>, probably I will make this possible).</li>
</ul>
<div class="section" id="installation">
<h3>Installation</h3>
<p>I don't like to describe how to install something, but in gentoo it's just one command (<a class="reference external" href="http://rafaelmartins.eng.br">Rafael G. Martins</a> - author of blohg - is gentoo developer) (<em>while I looked at his site, I saw many goodies, I'll try to get to know them and describe here</em>):</p>
<pre class="brush: bash">
$ emerge blohg
</pre>
</div>
<div class="section" id="usage">
<h3>Usage</h3>
<p>Create repository:</p>
<pre class="brush: bash">
$ blohg initrepo --repo-path my_blohg
</pre>
<p>Set up settings in <em>config.yaml</em>, tune up templates (in <em>templates</em> directory).</p>
<p>After that, write posts (in <em>content/post</em> directory), create attachments (in <em>content/attachments</em>) and commit changes.</p>
</div>
<div class="section" id="deploy">
<h3>Deploy</h3>
<p>Clone repo to remote host:</p>
<pre class="brush: bash">
$ hg clone my_blohg ssh://user@yourdomain.tld/path/to/my_blohg/
</pre>
<p>I use <a class="reference external" href="http://www.lighttpd.net">lighttpd</a> as web-server.</p>
<p><em>mod_fastcgi.conf</em>:</p>
<pre class="brush: plain">
fastcgi.debug = 0
fastcgi.server = ("/" =>
(
"blohg" => (
"socket" => "/tmp/blohg-fcgi.sock",
"bin-path" => "/var/www/blohg.fcgi",
"check-local" => "disable",
"fix-root-scriptname" => "enable"
)
)
)
alias.url = (
"/static/" => "/var/www/blog/static"
)
url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/favicon.ico.*)$" => "/static$1",
)
</pre>
<p>Contents of <em>/var/www/blohg.fcgi</em> (python module <a class="reference external" href="http://pypi.python.org/pypi/flup">flup</a> is needed):</p>
<pre class="brush: python">
#!/usr/bin/python
from flup.server.fcgi import WSGIServer
from blohg import create_app
if __name__ == '__main__':
application = create_app('/path/to/my_blohg')
WSGIServer(application).run()
</pre>
</div>
<div class="section" id="improvements">
<h3>Improvements</h3>
<div class="class strikeout container">
<p>In <a class="reference external" href="/post/my-server/?lang=en">post about my server</a> I wanted to make strikeout text,
but sadly reStructuredText don't support that.
I patched docutils, <a class="reference external" href="http://blog.f-y.name/attachments/docutils-0.7-strikeout.patch">here's a patch</a>.
But I want to move this functionality to blohg.</p>
<p><strong>UPD</strong>: Done, <a class="reference external" href="http://hg.f-y.name/blohg/changeset/c82ba2f18ad9">changeset</a>.</p>
</div>
<p><strong>UPD2</strong>: Done properly. <a class="reference external" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html#custom-interpreted-text-roles">There is</a> standard way to define custom roles which only adds class to <span> tag:</p>
<pre class="brush: plain">
.. role:: strikeout
:class: strikeout
</pre>
<p>Or you can add a block to container with strikeout class:</p>
<pre class="brush: plain">
.. container::
:class: strikeout
</pre>
<p>I made a fork of blohg on <a class="reference external" href="http://bitbucket.org">http://bitbucket.org</a>, to publish my changes: <a class="reference external" href="http://hg.f-y.name/blohg">fork</a>.
More precisely, I made a fork of Ry4an's repository, because Rafael serves hg repository from his own server.</p>
<p>Looked at <a class="reference external" href="http://hg.rafaelmartins.eng.br/rst-resume/">rst-resume</a>, I want to publish my resume at this site.</p>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js"></script>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js"></script>
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js"></script>
<link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css"/>
<script type="text/javascript">SyntaxHighlighter.defaults.toolbar=false; SyntaxHighlighter.all();</script></div>