Google Groups

Re: janrain dynamic hostname in url

Anthony May 19, 2012 11:23 AM
Posted in group: web2py-users

url = URL('default', 'user', args='login', host=True, scheme=True)

That will construct a URL including the current host and the current scheme (i.e., http or https).

More generally, the current host can be found in request.env.http_host, and the current scheme in request.env.wsgi_url_scheme (request.is_https also indicates whether the scheme is https or not). See for more details about the request and response objects.


On Saturday, May 19, 2012 1:32:41 PM UTC-4, rjmolesa wrote:
How can I get the host name that web2py is running on so that I can simply deploy a janrain enabled app without editing each time

auth.settings.login_form = RPXAccount(request, 
url = "http://" + application.hostname + "/%s/default/user/login" % request.application)