I am in the process of migrating an application (Sage) from Twisted to Django.
Static documentation is currently served under
/doc/static, while live (built on-the-fly) documentation are served under
Is it possible to use Twisted to serve
/doc/static only, leaving Django to serve the rest of
It can be done, the degree of elegance just varies... I understand this is for transition, so it might not have to be very beautiful.
If you have to have Twisted serving the static files, then you either have to hack together in django a proxy-through for those files, or throw something in front of the whole thing. Also Perlbal with VPATH could do this, it'll take regexp's of urls and make them hit the right services.
If you don't have to use Twisted, there are lots of different ways to do it. You could still use Perlbal or something similar to serve static files, something you should have anyway in the long run.
Have a look at this link on how to run Django on top of Twisted: (instructions copied from the blog)
Create a myapp.py with the following code:
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
Further down in the comments there is also an example of how to serve media directly with Twisted before the request is passed on to Django:
To handle media files just use "static.File" from "twisted.web" like so: staticrsrc = static.File(os.path.join(os.path.abspath("."), "mydjangosite/media")) and then add that resource to your root resource like so: root.putChild("media", staticrsrc)
Disclaimer: I have not tried this myself, but the blog article seems quite recent and the author willing to respond to questions.
EDIT: There is also another article written on the subject with instructions on how to get it working here, which seems to include servering static files with Twisted directly.
Unless I misunderstood the question, why not simply rewrite the /doc/static url to Twisted before it even reaches Django (ie. at the Apache / proxy level)?