On 15 Feb 2014, at 7:49 AM, Ykä Marjanen <yka.marja...@gmail.com> wrote:
> I got the scheduled background script working in PA. The script is started in 
> web2py environment with -S app and -M -R parameters. The script generates 
> emails, which include links (e.g. registration link with UUID).
> 
> I use scheme=True and host=True to generate absolute URL. This works when I 
> generate the emails directly from a website request. But when the scheduled 
> script generates it in the background, the URL has local host (127.0.0.1) and 
> not the real domain.
> 
> I assume that because I generate the link in a background script, web2py 
> instance lives in the local host and doesn't "see" the outside world (like 
> when a website request happens).
> 
> Should I just generate the domain manually, or do I have any better way to 
> replace the localhost with the real domain?
> 
> 

You might try socket.gethostname(). 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to