On Apr 2, 2012, at 2:57 AM, Joseph.Piron wrote:
> For one of my applications, I use web2py as a rest backend for a extjs 
> application. So, in order to redirect to this app, I have 
> def index():
>     """
>     example action using the internationalization operator T and flash
>     rendered by views/default/index.html or views/generic.html
>     """
>     redirect(URL(a=request.application, c='static', f='index.html'))
> 
> 
> The problem is I want to have only the server name in the url so I added a 
> routes.py with 
> routers = dict(
>  BASE = dict(
>  default_application = "webmoni",
>  applications = ['webmoni','admin'],
>  controllers = 'DEFAULT'
>  )
> )
> 
> but it seems that the redirect neglects the default_application removal 
> attempt from the url. 
> How can I achieve this ? (not to have 
> https://webmoni/webmoni/static/index.html as displayed url)

The static 'controller' is a special case. It's not mapped by default, to make 
it easier for external (server) rewrites. Add map_static = True to your router 
to accomplish what you're after. (Also, 'static' can never be the default 
controller.)

> 
> Moreover, I did try the domains option but there were no way for me to get 
> access to the admin app?
> Could anyone give an example with port 80 to app and 443 to admin using 
> domains option ?

        domains = {
                "domain.com:80"  : "app",
                "domain.com:443" : "admin",
        },

However, the stock /app/appadmin does things like this:

        URL('admin', 'default', 'design', args=[request.application])

...and that will cause you problems, because it won't generate a secure access. 
What ought to work in this example would be the following, in all cases in 
which URL refers to admin (I haven't tested this):

        URL('admin', 'default', 'design', args=[request.application], 
scheme='https')

Reply via email to