I am taking first steps with Twisted Web (after a brief play 18 months ago) and want to port across a large number of existing web apps which currently run under Apache. These apps currently use our own very simple CGI framework with App, Request and Response classes. It took me under 1 hour from download to having a running .rpy file which wraps my own framework and actually runs through the main actions of the apps, passing all parameters correctly. I am VERY impressed....
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/"
In general these let each app refer to static web content which is shipped in that app's code base. I have hundreds of page templates, and would really like to avoid changes so I can "parallel run" cgi and twisted on different ports.
Is there some way I could define these in twisted.web?
(I can see the Alias in twisted.web.rewrite, but have not found any examples of usage. I think I could see how to create a fooimages.rpy resource which explicitly trawls through the corresponding directory, but it would have .rpy on it)
Many thanks,
Andy Robinson CEO/Chief Architect ReportLab Europe Ltd tel +44-20-8544-8049
-----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
David Reid wrote:
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'))
Thanks!
.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
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
Aha. I simply started with the twisted.web documentation for version 2. I think your links and the other email give me enough, will try again tonight.
Thanks,
Andy Robinson
Andy Robinson wrote:
Alias /fooimages/ "C:/code/customer/fooserver/images/" Alias /barimages/ "C:/code/customer/barserver/images/"
http://twistedmatrix.com/projects/web/documentation/howto/using-twistedweb.h...
Andy.