I actually just modified gluon/main.py to temporarily do what i
wanted.

So what I did was, in my dispatch.fcgi
import  __builtin__
__builtin__.APP_NAME='welcome'
before importing gluon.main
then in gluon/main.py when rewrite.load() happens i check that
variable.
import __builtin__
if __builtin__.APP_NAME:
  rewrite.load('applications/' + __builtin__.APP_NAME +'/routes.py')
else:
  rewrite.load()

then i just have rewriteCond in my .htaccess to just use different
dispatcher per application.

also another question, I notice when I edit it online, it takes time
before the changes takes effect. How long is that?
But I don't edit stuff on live, I just tried to make a solution for
this in that shared hosting company.
Thanks

On Aug 6, 9:14 am, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Aug 6, 2010, at 7:52 AM, Lasiaf wrote:
>
> > cool.
> > is there any date on when it will be added?
>
> I've been promising to write a new route-rewriter for months now, and not 
> finding the time. Massimo has suggested an interim solution to allow 
> app-specific routing using the current logic which ought to be fairly 
> straightforward. I'll try to take a shot at it (there are a couple of minor 
> questions to be resolved, though), but I won't get my feelings hurt if 
> someone else beats me to it.
>
> Does this work for you?
>
> routes.py gets a new regex pattern, processed before routes_in, called 
> routes_app. Its output is an app name, or nothing. If applying routes_app 
> results in an app name, and there exists a file 
> applications/appname/routes.py, then we'll use that file's 
> routes_in/out/error. Otherwise we'll continue normally.
>
> The app-specfic routes_in will be processed *exactly* the same as the 
> top-level one; it still needs to rewrite the URL to have the correct app 
> name, for example.
>
>
>
>
>
> > Thanks
>
> > On Aug 4, 3:41 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> >> this is on our todo list
>
> >> On Aug 4, 4:19 pm, Lasiaf <fai...@altlimit.com> wrote:
>
> >>> Hi,
>
> >>> I'm new to web2py and python.
> >>> Here is what I wanna accomplish:
> >>> I want to haveroutes.py in each application, so I can make separate
> >>> applications with different set ofroutes, because I will be hosting
> >>> it in a shared hosting and they have limited inodes of 50,000. So I
> >>> just want to keep a copy of 1 web2py folder and have multiple
> >>> applications inside.
> >>> so if I haveroutes.py in applications that means I could just add
> >>> differentroutesthere. But I don't think thats a built in method.
>
> >>> Another I could access request.env.http_host and set differentroutes
> >>> fromroutes.py, if this is an ok method, how do I access request
> >>> object?
> >>> Also another thing is maybe I could set something in my dispatch.fcgi
> >>> to use different file thanroutes.py, if so how do I do it? then i'll
> >>> just have to mess around with my .htaccess
>
> >>> Thanks

Reply via email to