[Twisted-web] Sample code to run twisted web server

Andrea Arcangeli andrea at cpushare.com
Tue Jan 18 08:54:52 MST 2005

On Tue, Jan 18, 2005 at 08:00:39AM -0500, orbitz wrote:
> Doing .rpy's tends to stink, it's afflicted by problems of persistence 
> last time I used it. Why not just make a full web app that runs it's own 

persistence? Do you mean twistd -nf is actually going to work? I get
errors every single time during shutdown. I thought I could get easy
session persistence with it, that's why I tried. If I could get session
persistence that way, I would be really happy. However dialtone convinced me
it's nicer to get it with sql in the meantime.

          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/internet/defer.py", line 243, in callback
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/internet/defer.py", line 304, in _startRunCallbacks
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/internet/defer.py", line 329, in _runCallbacks
            self.result = callback(self.result, *args, **kw)
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/internet/base.py", line 327, in _cbContinueSystemEvent
        --- <exception caught here> ---
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/internet/base.py", line 335, in _continueSystemEvent
            callable(*args, **kw)
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/persisted/sob.py", line 125, in save
            self._saveTemp(filename, passphrase, dumpFunc)
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/persisted/sob.py", line 93, in _saveTemp
            dumpFunc(self.original, f)
          File "/home/andrea/bin/i686/python/lib/python2.4/site-packages/twisted/persisted/sob.py", line 109, in dumpFunc
            pickle.dump(obj, file, 1)
          File "/home/andrea/bin/i686/python/lib/python2.4/copy_reg.py", line 69, in _reduce_ex
            raise TypeError, "can't pickle %s objects" % base.__name__
        exceptions.TypeError: can't pickle function objects

For the other twisted processes (not the web above) persistence seems working,
though I'm not planning on depending on it either.

More information about the Twisted-web mailing list