Posts

Showing posts from July, 2007

Running a WSGI Application inside Twisted

There are a few ways to run a WSGI application, and today I will comment on the Twisted approach. The magic happens from the twisted.web2.wsgi module, and is fortunately simple. The main advantages I can think of when running with Twisted/Twistd is that: All Python solution (if that really is an advantage) Ability to run other twisted services. Did you want RPC, Email, FTP, remote shell etc for free? Twisted authorization framework Since the application in question has a very simple web part, and is predominately a remote GUI application, this seems the perfect solution. First make a tac file, which you will be running with the old favourite: twistd -ny mytac.tac On to some code: # This is my process for creating my WSGI application. You may have other methods. from graelsite.www.application import make_app from graelsite.www import config wsgi_app = make_app(config) # Now on to the real stuff from twisted.application import service, strports from twisted.web2 import server, channel, w

PyGTK, Py2exe, and Inno setup for single-file Windows installers

I am lucky, as part of my job, I get to code PyGTK. The downside is of course that I have to deploy these applications on Windows. Now these Windows users (especially at the price they are paying for this stuff) don't install dependencies, don't understand what a scripting language or interpreter is, and frankly they should not have to. Unfortunately, the list of dependencies for a PyGTK application (at the very minimum) is Python, GTK, PyGTK, PyGObject, PyCairo. 5 installers! So very early on in this project I found the way to give them exactly what they want and deserve, a single-file executable installer. There are a few guides online about how to achieve this, but none seem to work, and none are particularly new. How do we achieve this? The toolchain involved consists of two elements: 1. Py2exe website 2. Inno Setup website NOTE: The documentation for all the tools used is extensive, I will not repeat everything in there. Py2exe Py2exe is a distutils extension that searches