On 2012-03-31, at 05:27 , PJ Eby wrote: > On Fri, Mar 30, 2012 at 2:22 PM, Sasha Hart <s...@sashahart.net> wrote: > >> I do really like the idea of having a quick WSGI runner in the stdlib, >> > Regarding modules vs. files, I don't really care that much which way the > capability is spelled, as long as the file vs. module distinction is > explicit. "-m " isn't a lot to add to a command line, and neither is "-f > ". If there's no consensus, just require that one or the other be > specified, and inconvenience both groups of people equally. ;-)
Let's go with that. I'm not sure if I should be using sub-commands or options so for now I've used options. UI changes from initial patch: * Exclusive options for getting the application callable from a script (via `exec`) or a module (using `importlib.import_module`) * Application name specification has been moved to an option (default: `application`) * Option to serve the request only once (default: forever) when mounting a custom application * Option to open a browser window/tab to the (host, port) specified (which still default to '' and 8000 respectively) > python -mwsgiref.simple_server -h usage: simple_server.py [-h] [-H HOST] [-p PORT] [-s SCRIPT | -m MODULE] [-a APP] [-1] [-b] Mount and serve a WSGI application. If no script or module is specified, mounts wsgiref.simple_server.demo_app optional arguments: -h, --help show this help message and exit -H HOST, --host HOST Host to listen on -p PORT, --port PORT Port to listen on (defaults to 8000) -s SCRIPT, --script SCRIPT WSGI script file to execute and get the application from -m MODULE, --module MODULE Python module to import and get the application from Script or module options: These options do not apply when mounting the demo_app -a APP, --app APP, --app-name APP Name of the application variable in the script or module, application if none is provided -1, --once Only handles a single request, then exits -b, --browse Launch browser to the served URL
simple_server.patch
Description: Binary data
_______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com