I have complex flask application with several Flask instances dispatched by werkzeug middleware. And in such situation I have two questions related not actually with url_for, but with flask context management actually.
1) How do I create url from one application to another?
2) Main one - how do I create url for specific application with no app_context at all. For example i need to create some url on import time or from celery task. I tried to do wrapper over all application instances and redefine url_for like
def url_for(self, *args, **kwargs):
with self.app.app_context():
return url_for(*args, **kwargs)
but just received following error "Application was not able to create a URL adapter for request independent URL generation. You might be able to fix this by setting the SERVER_NAME config variable." Any suggestions?
Update: my solution for second problem was correct, just needed to add SERVER_NAME, but first one is still open