TiddlyWeb Now Reloads Code

I’ve begun working on the server-side of TiddlyWeb a bit, mostly to make stuff degrade gracefully as I begin to build a Trails facility into Scrumptious. In TiddlyWeb, an app-specific plugin is how you build an app on the server-side (or you can use a completely separate web framework like Django or Rails, making server-to-server RESTful calls, but that’s another story).

I asked about reloading code on the group this week. I want to change my Python code and hit reload in the browser and see the changes. To me, this this kind of “hot deploy” during development is a must-have for any web framework. There’s an argument that testing would render it unnecessary, but (a) it’s difficult to write tests when you’re learning and exploring an environment; (b) kool-aid aside, some things can’t be tested or are Test-Driven Design is simply not the most productive way to develop it (it comes down to forces – a cost-benefit analysis); (c) functional and integration tests, working across the whole server, and reloading code on each request is an easy way to make those happen.

Anyway, Chris has kindly produced the necessary pieces.

Here’s how I got it working. Here’s what I did to get it working on Mac, which is slightly different from Linux setup:

  • Download reloader.py and wserver.py stick them in top-level tiddlyweb instance directory.
  • Introduce the following to your tiddlywebconfig.py: 'twanager_plugins': ['wserver']. Note – do not try to use reloader as a plugin; it just needs to be in your directory as wserver uses it.
  • Run the server using twanager wserver.

If you have browser caching on, you might need to hit shift-reload at times. I don’t have caching on and it works fine with just reload. This is a big help, thanks Chris.

One thought on “TiddlyWeb Now Reloads Code

  1. I just started using this today – and it is quite useful indeed! (I started out being a bit paranoid, restarting manually every so often – but monitoring the CherryPy terminal revealed that reloader is very reliable.)

Leave a Reply