Kevin Dangoor wrote:
> I'm working on the deployment aspects right now (what good's an app if
> you can't stick it out in front of the world, right?)
>
> You can toss a PHP app on just about any server on the net. A CherryPy
> app is a little pickier... Regardless, I'd like to make sure that it's
> really easy to get a TurboGears app in front of the world.
I think Paste Deploy has some good potential for making deployment
generally simpler:
http://pythonpaste.org/deploy/paste-deploy.html
Basically you make your application a package (done already!), using
setuptools (done too!), and with a special entry point
(paste.app_factory) with the signature:
def make_app(global_config, **local_config):
return WSGI_application
Then deploying the application means installing it (just using
setuptools/easy_install) and creating a configuration for it, like:
[app:main]
use = egg:MyPackage
local_conf1 = foo
local_conf2 = bar
The configuration itself just describes the application instance; right
now you can use that with "paster serve" to serve the application, but
you can also use it for various kinds of indirection. So at work each
site has a file "apps.ini", and it looks like:
[composit:main]
use = egg:Paste#urlmap
/app1 = config:app1.ini
/app2 = config:app2.ini
/login = egg:LoginManager
And each of those "config:filename" sections refers to the application
described by that file, and it dispatches based on URL (virtual domain
is also possible). There's lots of other ways to compose applications
as well, but this is probably the most useful way.
The long-term goal is that an ISP could set up one file like this for
each of their clients, and allow packages to be installed somehow
(probably client-local via ~/.pydistutils.cfg), and each client gets an
application server of some sort (could be paster, but it could be
whatever... the API for getting a WSGI app from a config file is very
simple). I also want to set up a #! line that will turn any config file
into a CGI script, among other things. In general, how the app server
works is something yet to be determined. For instance, supervisor looks
cool for managing it:
http://plope.org/software/supervisor/). Or it
would be neat to have a loader that spawns the application in a seperate
process, maybe only on demand -- then seldom-used applications could
take zero resources until they get used, but with some form of caching
so that they stay in memory for a little while once they are used to
avoid the per-request overhead.
Anyway, regardless of features this makes it easy to keep those concerns
separate from the application itself.
--
Ian Bicking /
ia...@colorstudy.com /
http://blog.ianbicking.org