Ignore:
Timestamp:
Dec 21, 2009, 12:05:15 AM (15 years ago)
Author:
quentin
Message:

Properly separate the auth.fcgi and unauth.fcgi scripts

Location:
package_branches/invirt-web/cherrypy-rebased/code
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy-rebased/code/invirt.fcgi

    r2734 r2739  
    1212
    1313def usage():
    14     print >>sys.stderr, """%s [config]
     14    argv0_dir = os.path.dirname(sys.argv[0])
     15    print >>sys.stderr, """%s <unauth|auth> [config]
     16%s/auth.fcgi [config]
     17%s/unauth.fcgi [config]
    1518
    1619Run server as FastCGI, with CherryPy config from "main.conf".
     
    1922
    2023Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get
    21 the authenticated or unauthenticated site respectively.
    22 """ % sys.argv[0]
     24the authenticated or unauthenticated site respectively, or pass
     25'auth' or 'unauth' as the first parameter.
     26""" % (sys.argv[0], argv0_dir, argv0_dir)
    2327    sys.exit(2)
    2428
    2529if __name__ == "__main__":
    26     if len(sys.argv) > 2:
     30    if len(sys.argv) > 3 or len(sys.argv) == 1 or '-h' in sys.argv or '--help' in sys.argv:
    2731        usage()
    28     if len(sys.argv) > 1:
    29         if sys.argv[1] in ('-h', '--help'):
    30             usage()
    31         conf_file = sys.argv[1]
     32    if len(sys.argv) == 3:
     33        mode = sys.argv[1]
     34        conf_file = sys.argv[2]
    3235        dev = True
    3336    else:
     37        mode = sys.argv[1]
    3438        conf_file = os.path.join(base_dir, 'main.conf')
    3539
     
    4044        }
    4145
    42     if os.path.basename(sys.argv[0]).startswith('auth'):
     46    if mode.startswith('auth'):
    4347        root = main.InvirtWeb()
    44     elif os.path.basename(sys.argv[0]).startswith('unauth'):
     48        app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-auth-web-templatecache"
     49    elif mode.startswith('unauth'):
    4550        root = main.InvirtUnauthWeb()
     51        app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-unauth-web-templatecache"
    4652    else:
    4753        usage()
  • package_branches/invirt-web/cherrypy-rebased/code/main.conf

    r2670 r2739  
    33#auto_reload doesn't work with FastCGI
    44engine.auto_reload = False
    5 tools.mako.module_directory = "/tmp/invirt-web-templatecache"
    65tools.remote_user_login.on = True
    76
Note: See TracChangeset for help on using the changeset viewer.