X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/dcc31a134b159000ef724866f6bd02d5beb076ff..021528d994812f6e794cffbd098109ced57866a3:/code/invirt.fcgi diff --git a/code/invirt.fcgi b/code/invirt.fcgi index c01eb7f..0bce132 100755 --- a/code/invirt.fcgi +++ b/code/invirt.fcgi @@ -11,26 +11,30 @@ dev = False base_dir = os.path.dirname(__file__) def usage(): - print >>sys.stderr, """%s [config] + argv0_dir = os.path.dirname(sys.argv[0]) + print >>sys.stderr, """%s [config] +%s/auth.fcgi [config] +%s/unauth.fcgi [config] Run server as FastCGI, with CherryPy config from "main.conf". With `config`, run standalone with CherryPy config from `config`. Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get -the authenticated or unauthenticated site respectively. -""" % sys.argv[0] +the authenticated or unauthenticated site respectively, or pass +'auth' or 'unauth' as the first parameter. +""" % (sys.argv[0], argv0_dir, argv0_dir) sys.exit(2) if __name__ == "__main__": - if len(sys.argv) > 2: + if len(sys.argv) > 3 or len(sys.argv) == 1 or '-h' in sys.argv or '--help' in sys.argv: usage() - if len(sys.argv) > 1: - if sys.argv[1] in ('-h', '--help'): - usage() - conf_file = sys.argv[1] + if len(sys.argv) == 3: + mode = sys.argv[1] + conf_file = sys.argv[2] dev = True else: + mode = sys.argv[1] conf_file = os.path.join(base_dir, 'main.conf') app_config = { @@ -39,10 +43,12 @@ if __name__ == "__main__": }, } - if os.path.basename(sys.argv[0]).startswith('auth'): + if mode.startswith('auth'): root = main.InvirtWeb() - elif os.path.basename(sys.argv[0]).startswith('unauth'): + app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-auth-web-templatecache" + elif mode.startswith('unauth'): root = main.InvirtUnauthWeb() + app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-unauth-web-templatecache" else: usage()