Diez B. Roggisch wrote: > On Tuesday 03 February 2009 00:27:48 James wrote: > >> Hi all, >> Is there a convenient way to work out what the URL of the current >> application is? Netloc, port and context root? >> > > No. It could be deployed as WSGI-app inside an apache, and that inside a > VHost. You can't possibly deduce that. Make it a configuration variable. > You can if you're in the context of a request, environ holds all that information. To build the base url of the current application you can do:
url = '%s://%s%s' % tuple(environ[k] for k in "wsgi.url_scheme", "HTTP_HOST", "SCRIPT_NAME") environ can be accessed at tg.request.environ in TG2 or cherrypy.request.wsgi_environ in TG1. Alberto --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

