[Twisted-web] Simplest way to mimic Apache/IIS virtual directories?

David Reid dreid at dreid.org
Mon Apr 25 19:36:40 MDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andy Robinson wrote:
> 
> One last problem.  My app suite has a lot of mappings like 
> this defined in the Apache config file:
> 
> Alias /fooimages/ "C:/code/customer/fooserver/images/"
> Alias /barimages/ "C:/code/customer/barserver/images/"

from twisted.web import resource, static

root = resource.Resource()
root.putChild('fooimages', static.File('/path/to/foo/images'))
root.putChild('barimages', static.File('/path/to/bar/images'))

.rpys are bad.  They were a bad idea implemented badly and their use is
strongly discouraged, even for development they are bad and should never
contain more than

from my.fancy.web.code import MyResource
resource = MyResource()

if you're using .rpys i assume you're using mktap to build the webserver
configuration, .taps are also discouraged, and the best way to deploy
twisted.web applications is with .tac files.  see

http://twistedmatrix.com/projects/core/documentation/howto/application.html

for details.

Enjoy,
- -David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCbZsorsrO6aeULcgRAtvbAJ9KBPui8YJfpibxb4E9LWNPBu9GdgCdFkMg
vKVZjxNuPUiRo3AozewKyuU=
=GlI1
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list