I plan on shoving this in the app specific routes.py - so it shouldn't mess
with the other apps.
I tried your code, but it didn't work as expected. You have the right idea
though in regards to what I'm trying to do lyn2py. I want to literally
shove anything in front of app/controller/function. It's just going to act
as a URL prefix. Then later on, I will use the request object to extract
this URL prefix and then change the db connection string. Having the URL
prefix is mandatory, compared to just simply having it as args as you
suggested earlier. If you can continue to help me I will buy you lunch :)
I think we are really close!
On Thursday, July 24, 2014 12:29:19 PM UTC-5, lyn2py wrote:
>
> I am not exactly sure I understand your question, and I don't know how
> your code looks like, but you could try this:
>
> routes_in = (
>
> ('/$anything/$a/$c/$f', '/$a/$c/$f/$anything')
>
> )
>
> If you are going to have multiple apps though, this routing system will
> most likely break, unless they all follow the same kind of routes and have
> the same kind of code, in which case you might want to consider making sam
> an app.
>
>
>
> On Friday, July 25, 2014 1:03:51 AM UTC+8, Michael Gheith wrote:
>>
>> That's a great idea lyn2py, but I expect to run multiple applications in
>> one web2py instance. I can't have all my applications with the name of sam
>> unfortunately.
>>
>> I just discovered that I can add a URL prefix of "fff" with the following
>> code:
>>
>> routes_in = (
>>
>> ('/fff/$a/$c/$f', '/$a/$c/$f')
>>
>> )
>>
>>
>> routes_out = (
>>
>> ('/$a/$c/$f', '/fff/$a/$c/$f')
>>
>> )
>>
>>
>> Is it possible to change fff to be variable based on the URL? If so,
>> how? If we can figure that out then I think my issue will be solved.
>> Please help!
>>
>>
>> On Thursday, July 24, 2014 11:37:01 AM UTC-5, lyn2py wrote:
>>>
>>> In that case,
>>>
>>> Make sam your app's name, client1 and 2 can be the functions within the
>>> controller, or separate controllers for each client.
>>>
>>> If they share functions, you could shift your function's logic outside
>>> (into a module).
>>>
>>>
>>>
>>> On Thursday, July 24, 2014 11:50:28 PM UTC+8, Michael Gheith wrote:
>>>>
>>>> Hello lyn2py,
>>>>
>>>> Thank you for your response. Unfortunately it is necessary for me to
>>>> have the URL prefix of /sam/<client>. I would imagine your strategy would
>>>> work if it was possible to dynamically add a URL prefix, but I don't think
>>>> there is a way to do that. Anyone else have any ideas? Massimo?
>>>>
>>>> Best,
>>>> Michael Joseph Gheith
>>>>
>>>> On Wednesday, July 23, 2014 9:22:30 PM UTC-5, lyn2py wrote:
>>>>>
>>>>> You are pointing client1 and client2 to the same representation of the
>>>>> routes. It won't work properly.
>>>>>
>>>>> If you have separate domains for separate clients, see
>>>>> scripts/autoroutes.py
>>>>>
>>>>> If you want to serve customized to different clients, you might want
>>>>> to do
>>>>>
>>>>> http://127.0.0.1:8000/sam/<appname>/default/index/client1
>>>>> http://127.0.0.1:8000/sam/<appname>/default/index/client2
>>>>>
>>>>> EDIT: No wait… what is sam doing in there… it should be:
>>>>>
>>>>> http://127.0.0.1:8000/ <http://127.0.0.1:8000/sam/>
>>>>> <appname>/default/index/client1
>>>>> http://127.0.0.1:8000/ <http://127.0.0.1:8000/sam/>
>>>>> <appname>/default/index/client2
>>>>>
>>>>> and have index pull request.args(0) to match to correct client
>>>>>
>>>>> On Thursday, July 24, 2014 12:41:29 AM UTC+8, Michael Gheith wrote:
>>>>>>
>>>>>> What I'm trying to do is to have my application serve 2 different
>>>>>> customers via URLs like the following:
>>>>>>
>>>>>> http://127.0.0.1:8000/sam/client1/<appname>/default/index
>>>>>> http://127.0.0.1:8000/sam/client2/<appname>/default/index
>>>>>>
>>>>>>
>>>>>> My routes.py looks like:
>>>>>>
>>>>>> routes_in = (
>>>>>>
>>>>>> ('/sam/client1/$a/$c/$f', '/$a/$c/$f'), (
>>>>>> '/sam/client2/$a/$c/$f', '/$a/$c/$f')
>>>>>>
>>>>>> )
>>>>>>
>>>>>>
>>>>>> routes_out = (
>>>>>>
>>>>>> ('/$a/$c/$f', '/sam/client1/$a/$c/$f'), ('/$a/$c/$f',
>>>>>> '/sam/client2/$a/$c/$f')
>>>>>>
>>>>>> )
>>>>>>
>>>>>>
>>>>>> This works great for client1. The minute I use client2 the links use
>>>>>> client1 mappings in the URL. I'm using the URL function for all my
>>>>>> links.
>>>>>> Any ideas what I'm doing wrong? Perhaps this is an issue with web2py?
>>>>>> Please advise.
>>>>>>
>>>>>>
>>>>>> Thanks in advance!
>>>>>> M.G.
>>>>>>
>>>>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.