I think I would use the method I showed rather than links.

Anthony

On Thursday, August 23, 2012 10:54:11 AM UTC-4, curiouslearn wrote:
>
> Thank you, Anthony. That worked well. 
>
> Do you have an opinion on which is a better method (in terms of easier to 
> maintain, less problems that I cannot foresee given my lack of experience 
> building web apps): the links of using extend as suggested?
>
> Thanks again.
>
> On Thursday, August 23, 2012 10:30:33 AM UTC-4, Anthony wrote:
>>
>> {{extend ...}} takes a file path, not a URL, and it needs to be relative 
>> to the current application's /views folder. So you can use directory 
>> traversal to get to the other layout:
>>
>> {{extend '../../myadminapp/views/default/mylayout.html'}}
>>
>> The ../../ will go up two levels from /applications/current_app/views to 
>> /applications, and then the rest of the path follows from there.
>>
>> Anthony
>>
>> On Thursday, August 23, 2012 10:08:09 AM UTC-4, curiouslearn wrote:
>>>
>>> Hello,
>>>
>>> I searched on the forums here and it appears that the suggested solution 
>>> for accessing a layout file is to create links (hard links or soft links?). 
>>>
>>> I have two questions in this regard:
>>>
>>> (i) Is this solution robust to changes in where the application is 
>>> hosted? Would the links works regardless of whether I have it hosted on 
>>> EC2, or dotcloud, or pythonanywhere etc.
>>>
>>> (ii) Is it possible to do this using the {{extend ...}} command? If so, 
>>> I would appreciate an example. 
>>>
>>> For example, suppose I am in application called *participants *and I 
>>> want to use the layout file in application *myadminapp *(in *myadminapp* 
>>> the 
>>> layout file is in views/default/). I tried doing the following, but none of 
>>> these work. 
>>>
>>> {{extend URL(a='myadminapp', c='  ', f='views/default/mylayout.html')}} 
>>>  results in /myadminapp/ /views/default/mylayout.html
>>>
>>> {{extend URL(a='myadminapp', f='views/default/mylayout.html')}}  results 
>>> in /myadminapp/default/views/default/mylayout.html
>>>
>>> I also tried:
>>> {{extend '/myadminapp/views/default/mylayout.html'}}, which gives the 
>>> following error:
>>>
>>> <type 'exceptions.IOError'>([Errno 2] No such file or directory: 
>>> '/myadminapp/views/default/mylayout.html')
>>>
>>> This *error is strange* because there does exist an application 
>>> *myadminapp, 
>>> *with folder views with folder default with file mylayout.html.
>>>
>>> Thanks.
>>>
>>

-- 



Reply via email to