[Web-SIG] A more useful command-line wsgiref.simple_server?
masklinn at masklinn.net
Thu Mar 29 20:14:09 CEST 2012
On 2012-03-29, at 19:46 , PJ Eby wrote:
> * Add an option to serve a single request or forever
> * Have it optionally launch any script in the webbrowser, not just the demo
Should these options be activated only when not mounting the demo, or
all the time (meaning they'd default to single and open respectively, in
order not to change the current behavior?)
> * Allow use of a module instead of a script to obtain the application
How would the runner make the difference? Do it as Python does, a
positional script file and a -m option for a module?
> * drop the ':' separator syntax, or else use os.pathsep so that it works
> properly on Windows (where ':' can denote a drive letter)
Ah yes, I had not thought of that, this would be annoying and I don't
think the pathsep helps, since the script is an arbitrary path file it
can contain pathseps. A second — optional as well — positional parameter
would avoid that problem, would not be more typing and would remove the
need for some of the munging in the type callable.
But now that'd look weird with -m module, unless `-m` is not an
option-with-value but a boolean flag saying to treat the first
positional parameter as a module instead of a script.
That could work nicely, it'd depart somewhat from Python's own
semantics but not too much.
More information about the Web-SIG