Add options to specify binding address and port.
authorW. Trevor King <wking@drexel.edu>
Sun, 18 Jul 2010 18:40:09 +0000 (14:40 -0400)
committerW. Trevor King <wking@drexel.edu>
Sun, 18 Jul 2010 18:40:09 +0000 (14:40 -0400)
dirtag/web.py

index 4c4cd439c66a5bc7e1c9cc9ce096c16763975859..3826022493ff72deaf56ab077dd6d323fd5cae2a 100755 (executable)
@@ -146,6 +146,12 @@ if __name__ == '__main__':
     parser.add_option('-s', '--static-dir', dest='static_dir', metavar='DIR',
                       default='static',
                       help='Location of static files (%default)')
+    parser.add_option('-a', '--address', dest='address', default='127.0.0.1',
+                      metavar='IP',
+                      help='address that the server will bind to')
+    parser.add_option('-p', '--port', dest='port', default='8080',
+                      metavar='PORT',
+                      help='port that the server will listen on')
     parser.add_option('-n', '--name', dest='name', metavar='STRING',
                       default='dirtag',
                       help='Name of the dirtag repository')
@@ -163,6 +169,8 @@ if __name__ == '__main__':
     w = WebInterface(
         d, template_dir=options.template_dir, repository_name=options.name)
     cherrypy.config.update({
+            'server.socket_host': options.address,
+            'server.socket_port': int(options.port),
             'tools.encode.on': True,
             'tools.encode.encoding': 'utf8',
             })