Deployability

I finally took the time to rearrange Singleshot so it was in a Python package (‘singleshot’). The templates still aren’t quite in a home, but all the library code can now live in anywhere in the python path. I also moved most of the CGI code into a library and defined a simple entry point for a cgi wrapper script to use. And it no longer has magic code in it to try to figure out where the image root is based on where the CGI script is. This means (at least in theory) one could set up Singleshot with the CGI not in the image root at all.

I’ve also taken a step to improving the Singleshot install process:

./src/singleshot/initweb.py --url /singleshot/ --root www\
     --templatedir templates --path src --path lib

means: Set up singleshot in ‘www’ (by creating the appropriate .htaccess and CGI script entry point), ensure src and lib are on the path (since in this case lib contains all the 3rd party libraries and src contains the under-development singleshot source.

This generates the following CGI script in www: #!/usr/bin/python import sys sys.path.insert(0, ‘/home/fox/src/singleshot/lib’) sys.path.insert(0, ‘/home/fox/src/singleshot/src’) from singleshot import sscgi sscgi.main(baseurl=’/singleshot/’,root=’/home/fox/src/singleshot/www’, template_root=’/home/fox/src/singleshot/templates’)

as well as the .htaccess (with all required customization done) and view/ directory created. It can’t really know if view/ has to be world writable or if merely group or user writable is required. This means the majority of singleshot can be installed anywhere (for example, in python’s site packages directory using a still-to-be-written setup.py).