I'm new to Tornado, and trying to understand how can i update the static_path
on the fly. (The Xstatic will be similar i guess)
For example:
Application([
('/static1/(.*)', tornado.web.StaticFileHandler, dict(path='static1')),
('/static2/(.*)', tornado.web.StaticFileHandler, dict(path='static2')),
])
I want to be able to update the path on the fly, inside the implementation of one of those Handlers.
Is that even possible? I know there are tools like static_url_prefix
and update the static_path
via settings of tornado. But can i do it on the fly? during execution of one the Handlers.
My usecase: Why do i need it?
When i am connecting via proxy server to load the web page of the application, there is a header of "/proxy/aHR0cHM6Ly8xMC4xLjMuMTAwOjQ0Mw==/" added to the URL in the browser, so it probably changes the relative path and i need to adjust the location of the static sources accordingly. (currently the html page cannot find the static sources when proxy used)
The problem:
I cannot know if there is a proxy or not,when tornado is first loaded. I know that only later when one of the handlers catches the regex url.
Maybe i can somehow concatenate the proxy header to the static_url
parameter?
Thanks.
Aucun commentaire:
Enregistrer un commentaire