tags:

views:

739

answers:

4

I've been writing a fair number of smaller wsgi apps lately and am looking to find a web server that can be distributed, preconfigured to run the specific app. I know there are things like twisted and cherrypy which can serve up wsgi apps, but they seem to be missing a key piece of functionality for me, which is the ability to "pseudostream" large files using the http range header. Is there a web server available under a BSD or similar license which can be distributed as a standalone executable on any of the major platforms which is capable of both proxying to a a wsgi server (like cherrypy or the like) AND serving large files using the http range header?

+3  A: 

What's wrong with Apache + mod_wsgi? Apache is already multiplatform; it's often already installed (except in Windows).

You might also want to look at lighttpd, there are some blogs on configuring it to work with WSGI. See http://cleverdevil.org/computing/24/python-fastcgi-wsgi-and-lighttpd, and http://redmine.lighttpd.net/issues/show/1523

S.Lott
A: 

Theres nothing really "Wrong" with apache, its a great server, but i'm looking for something that I can distribute with my application, in a pre-configured state, so that it runs out of the box on any platform (i realize this will probably require a separate "box" per platform, but thats fine).

downvoted for not being an answer to the question... use comments
lubos hasko
+3  A: 

Lighttpd has a BSD license, so you should be able to bundle it if you wanted.

You say its for small apps, so I guess that means, small, local, single user web interfaces being served by a small http server? If thats is the case, then any python implementation should work. Just use something like py2exe to package it (in fact, there was a question relating to packaging python programs here on SO not too long ago).

Update, re: range header: The default python http server may not support the range header you want, but its pretty easy to write your own handler, or a small wsgi app to do the logic, especially if all you're doing is streaming a file. It wouldn't be too many lines:

def stream_file(environ, start_response):
  fp = open(base_dir + environ["PATH_INFO"])
  fp.seek(environ["HTTP_CONTENT_RANGE"]) # just an example
  start_response("200 OK", (('Content-Type', "file/type")))
  return fp
Richard Levasseur
A: 

Richard, The problem with the small python examples as i stated in my question, is that they dont handle the Http Range request properly (so no pseudostreaming videos)