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

Dave Cole djc at object-craft.com.au
Fri Jul 4 23:11:04 EST 2003


> Please feel free to include it in Albatross, that would obviously
> benefit me. I think the only thing that is missing is the file
> upload support but I still hope to fix that.
> 
> I don't really have a strong feeling on your change but it seems
> that making the application's module create an app object may make
> it less flexible although your solution is definitely the simplest
> and, as you point out, involves only a trivial change to the code.

Your original the harness expected the mainline to define an
application class constructor that takes zero arguments.  I figured
that since a CGI or mod_python app has to create an application object
in the mainline anyway, why not just reference that.

In other words, all mainlines do something like this:

app = AppClass(args_if_any)

> An even better solution might be to split al-httpd into a module,
> say albatross.server.httpd, leaving only the __main__ code in
> al-httpd itself.

LOL.  That is what I did with your first version before I had
understood your al-httpd intention :-).

> Applications could then create an instance of the http server
> manually *if necessary* or use al-httpd in the same way as now.  I
> see the mod_python vs cgi vs fcgi vs httpd as a deployment decision
> and nothing much to do with the application code itself or in other
> words ... who hows how someone might want to deploy an application
> based on Albatross on their server.

Exactly!

The al-httpd program and httpdapp module will be an excellent addition
to Albatross.

> I'm not sure if I have explained that too well but what I can
> imagine doing is having a series of startup scripts for the
> application depending on how I'm using it (i.e. dev vs
> prod). Sometime like this (completely untested):
> 
> -- standalone.py --
> from albatross.server import httpd
> import myapp
> 
> app = myapp.App(base_url = '/', base_dir = '/home/matt/src/myapp')
> 
> httpd = httpd.HTTPServer(app, 8000)
> httpd.serve_forever()
> --
> 
> -- app.py --
> from albatross import cgiapp
> import myapp
> 
> app = myapp.App(base_url = '/dev/myapp/app.py', base_dir =
> '/home/matt/src/myapp')
> app.run(cgiapp.Request())
> --

> What are your thoughts on this? I will split the al-httpd script up
> today, as detailed above, if you think it's a good approach, or if
> you want to keep it simple, I'm happy with that too.

I agree 100% that it should be split into an importable module and a
program to launch applications.

Andrew, do you have any excellent ideas about naming of the program
and module?

Off the top of my head I would like to rename the current
session-server directory to tools and place the new al-httpd program
in there.  I also think that the importable module should probably be
called httpdapp and should live side by side with fcgiapp, apacheapp,
and cgiapp.

Matt, this is different to what you have said above, but I think more
consistent with the current layout.

- Dave

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




More information about the Albatross-users mailing list