I've still only really scratched the surface and scanned over the page to get something up quickly but, in essence, you only need three things:
1. A webserver that supports CGI.And that's essentially it. Actually, you don't even need (2), as you can feed variables directly to the cgi script, but it makes it easier for the user, I think.
2. An html page containing some "form" code that contains a submit button and (optionally) some input options (e.g. text boxes or checkboxes).
3. A python script (or another language) that generates HTML code based on the variables and values from the form.
My first attempt at this can be found here. It's a bit of silly fun but it shows what can be done with just a few simple lines of code. I've cheated a little bit by using an existing python module to generate the middle of the HTML code but, in a way, that's the point - you can easily adapt existing functional code to output text.
In this case, I use the random "Zen wisdom" text strings that are generated in my code to lighten up error messages when I'm debugging. (If you ever use one of my programs, you sometimes come across such an error message, which always causes confusion (and usually embarrassment for me!) but I think it's a small price to pay for making debugging more fun!) The scary thing is how often the random Zen Wisdoms sound deep and meaningful, e.g.
"It is bold to play jenga with blocks of passion."Well, maybe not that deep and meaningful!
This comment has been removed by a blog administrator.
ReplyDeleteIt is wise to attend a conference about Chaos because an exhausted ladyboy ponders....
ReplyDeleteLike I said, not that deep and meaningful! (It appeared twice, so I deleted the first one, hope you don't mind.)
ReplyDeleteApparently, CGI is not the way forward and I need to check out CherryPy. Watch this space...