I do that for DB connection :

try:
    if request.env.http_host.split(':')[1] == '8005':
        raise error  # To use shell in prod/staging environnement
    elif request.env.http_host.split(':')[1] != '':
        db = DAL('postgres://richard:password@127.0.0.1:5432/db',
                 migrate_enabled=False,
                 lazy_tables=True
                 )
except Exception, e:
    db = DAL('postgres://richard_prod:password@127.0.0.1:5432/db',
pool_size=1, migrate_enabled=False,
             lazy_tables=True)

You surely can adapt to your case...

:)

Richard


On Wed, Jul 16, 2014 at 1:05 PM, Annet <anneve...@googlemail.com> wrote:

> I have a development and a deployment environment. In development all URLs
> are relative.
> The issue is I have 2 applications, 1 over http and 1 over https. When I
> move my
> applications to production I have to add scheme= ...and host=... to all
> URLs that are links
> between the 2 applications. Which is rather tedious and error prone.
>
> In production routes.py contains the following lines:
>
>
> routers = dict(
>   BASE  = dict(
>       domains = {
>           'www.domain.com' : 'init',
>           'my.domain.nl' : 'my',
>       }
>   ),
> )
>
> To solve my issue, is it possible to do something like:
>
> routers = dict(
>   BASE  = dict(
>       domains = {
>           'www.domain.com' : 'init',
>           'my.domain.nl' : 'my',
>       }
>       applications = {
>         'init' : 'http://www.domain.com',
>         'my' : 'https://my.domain.com',
>   ),
> )
>
> So, basically, a sort of reverse domains =
>
>
> Regards,
>
> Annet
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to