Jun 2014

Tue, 03 Jun 2014

Running Pyblosxom with gevent.wsgi

The gevent wsgi server is very easy to use from Python. I wrote a convenient wrapper which starts pyblosxom under gevent. This can be used to either serve your blog locally for testing or to serve the live system. The nice thing is that it doesn't require an extra apache or nginx server just to start serving it.

Full source code is located here.

The important piece:

from gevent import monkey; monkey.patch_all()
from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from Pyblosxom import pyblosxom

def start(host='', port=8007, threads=8):
  pool = Pool(threads)
  application = pyblosxom.PyBlosxomWSGIApp()
  server = WSGIServer((host, port), application, spawn=pool)

posted at 23:00 | path: /python | permanent link to this entry

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.