[albatross-users] New version of the standalone http server

Dave Cole djc at object-craft.com.au
Sat Jul 5 12:53:01 EST 2003


>>>>> "Dave" == Dave Cole <djc at object-craft.com.au> writes:

>>>>> "Matt" == Matt Goodall <matt at pollenation.net> writes:
Matt> Cool, I think this is the best solution overall - the simplicity
Matt> of al-httpd with the flexibility of the module. If you're happy
Matt> to make these changes then go ahead but just say if you want me
Matt> to do anything to help.

Dave> I will wait to see what Andrew says.  He always pokes holes in
Dave> my stoopid ideas.

Andrew didn't want me to rename the session-server directory so I have
added a new standalone-server directory.

In preparing the source I noticed some formatting differences between
Albatross and your code.  I went to PEP8 and had a read.  Albatross is
still not PEP8 clean :-(.  I might do some minor reformatting.

While placing the code into Albatross I realised that there is no
copyright on the code.  What do you want to do?

* Include a Matt Goodall BSD style copyright notice.

* Assign the copyright to us so we can just apply the same BSD style
  notice as is on the rest of the code.

Since the code is not ours you need to decide what to do here.

Anyway, I have split the mainline out so it now looks like this:

- - al-httpd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#!/usr/bin/env python
import os
import sys
from albatross import httpdapp

if __name__ == '__main__':
    # Append the current working directory to the path.
    sys.path.append(os.getcwd())

    # Parse the command line.
    try:
        app_module, app_object = sys.argv[1].split('.')
        port = int(sys.argv[2])
    except:
        sys.exit('usage: %s main-module.app-object port'
                 % os.path.basename(sys.argv[0]))

    # Load the application's module and get application instance.
    module = __import__(app_module)
    app = getattr(module, app_object)

    # Create the HTTP server and serve requests.
    httpd = httpdapp.HTTPServer(app, port)
    httpd.serve_forever()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list