November 16, 2011
To build uwsgi on Fedora 12 (which has no easy-to-find python3 rpm), run through the rpmbuild process (shown in a previous post in more detail for nginx) and make the following changes : wget http://kad.fedorapeople.org/packages/uwsgi/uwsgi-0.9.9.2-2.fc15.src.rpm rpm -ivh uwsgi-0.9.9.2-2.fc15.src.rpm rpmbuild -bb ~/rpmbuild/SPECS/uwsgi.spec yum install python-devel libuuid-devel jansson-devel libyaml-devel ruby-devel python3-devel python-greenlet-devel lua-devel ruby # NB: python3-devel [...]
November 14, 2011
In order to get access to uwsgi (useful for deploying python flask projects, for instance), one needs a version of nginx > 0.8 or so. But Fedora 12 doesn’t have such a modern version : Here’s how to build it from a src.rpm from a more recent Fedora release. # First, make sure we have [...]
October 17, 2011
In order to get access to uwsgi (useful for deploying python flask projects, for instance), one needs a version of nginx > 0.8 or so. But Fedora 12 doesn’t have such a modern version : Here’s how to compile it from source : Actually, a less hacky approach is to simply back-port (trivially) a src.rpm [...]
October 7, 2011
Here’s a pretty minimal setup for building an extension for LibreOffice in Python. Working backwards, I’ve called the extension ‘mdda_fns.oxt’. Here’s the makefile, which is in the root of the package development tree : all: clean zip install clean: unopkg remove mdda_fns.oxt rm mdda_fns.oxt [...]
July 13, 2011
Paster contains the WSGI server originally incorporated within CherryPy (see http://pythonpaste.org/script/module-paste.script.wsgiserver.html). Funnily enough, this is a pretty hot contender amongst other Python WSGI webservers (see http://nichol.as/benchmark-of-python-web-servers) : Maybe not the best, but because of its ease of set-up (working out-of-the-box for Pyramid and Pylons) it is extremely compelling. Combining it with NGINX makes for a [...]
January 29, 2011
This code snippet should clear up the confusing documentation when it comes to uploading an optional picture : import os from pylons import config import shutil class MyController(BaseController): def picture(self, registration=False): if ‘send_picture’ in request.params: if (‘picture’ in request.params) and hasattr(request.params[‘picture’], ‘filename’): [...]
November 5, 2010
Another ‘quickie’. Rather than update the central /usr/share/scite/SciTEGlobal.properties, just pull in the user’s properties from SciTE’s Options-OpenUserOptionsFile. There, add the following : find.files=*.p*|*.js|*.[ch]* if PLAT_GTK find.command=grep -R –include ‘$(find.files)’ –exclude ‘*.svn*’ -i –line-number ‘$(find.what)’ . tabsize=1 indent.size=1 use.tabs=0 indent.size.*.py=4 # NB : tabsize becomes tab.size for filepatterns… tab.size.*.py=4 lexer.html.mako=1 source.files=$(source.files);*.css;*.scss filter.css=CSS (css scss)|*.css;*.scss| lexer.*.css=css lexer.*.scss=css [...]
September 15, 2010
After looking around the web for an SQLalchemy model migration assistant, we found no satisfactory equivalent to the migration tool that people love for Ruby. In particular sqlalchemy-migrate seems like it’s an overkill (in addition, sqlalchemy-migrate is fiddly to set up with Pylons). There’s also a project call miruku, but that is also a little [...]
September 5, 2010
Just a quickie… To make SciTE work with mako files (which are template files used by the mako templating system included with Pylons), just add the following : In /usr/share/scite/SciTEGlobal.properties (on a Fedora machine at least, YMMV) : lexer.html.mako=1