I reply within.

On Sunday, 19 June 2016 14:35:37 UTC-4, Anthony wrote:
>
> I suppose you could put web2py in one directory, and then symlink to an 
> application folder in some other directory. But it seems odd that you 
> somehow don't have control over how the application code gets updated. 
> There are lots of mechanisms by which you could update application code. 
> For example, if you need to ensure that after the files in an application 
> folder are updated some additional special file gets injected into the 
> folder, you could presumably use a script or an automation tool such as 
> Ansible to manage the whole process.
>
>
It is not odd. You force me to be on the defensive. Please follow me with 
an analogy.  In this analogy, the execution of an application is like going 
to a restaurant. A person entering the restaurant is like a request.  The 
code is the menu. The bathroom is the configuration file where you need to 
go before you eat. The issue, in this analogy, is that the person needs to 
know  where is the bathroom.  Your solution is simply put the location of 
the bathroom in the menu. It's not stupid. It's true that, if we have a 
chain of restaurants, we could have a script that make sure that each menu 
has the correct location.  My solution is simply to have the person ask 
when it enters the restaurant. It's not odd at all. I actually thinks that 
it is better, more natural, than your solution, which, I agree, is the 
common approach.   
 

> Actually, if all you need is to set some configuration options, you could 
> do that by putting them in (a) a Python module that gets imported by the 
> app, (b) a configuration file that gets loaded via AppConfig, (c) OS 
> environment variables, etc.
>
> In my research, I already considered all these aspects. I am learning 
web2py and even python, but I am not new at these things. I will use (b), 
but this does not say where is the location of the config file.  Yes (c) 
could be used to set the location of the configuration file or directly 
store the configuration, but it has its drawbacks.  The location of the 
env. var. can depend on the systems. Also, some installer might not have 
access to these env. var.  A typical solution is to have the code search 
many locations, but it is not ideal, because after a few installations, 
there could be many configurations files at different locations. It is not 
as clean.  I do prefer the solution where the request asks for the 
location, just as when you ask where is the bathroom when you enter a 
restaurant.         
 

> The point is, the details depend on exactly what aspects of the system 
> need to be made modular as well as the mechanism by which app code will be 
> updated. And the solution(s) will likely be largely independent of web2py, 
> relying more on standard Python mechanisms (e.g., imports), OS features 
> (e.g., symlinks), and various development/deployment tools (e.g., bash 
> scripts, git, Ansible, etc.).
>

I am sure I could learn more about these things.
 

>
> Anyway, if you have a particular setup and workflow in mind, perhaps you 
> can explain how it would be achieved when using an alternative web 
> framework (either another Python framework, such as Django or Flask) or a 
> PHP framework. Then maybe we can see if there is an analog for web2py.
>
>
It is not because what I propose for myself is not implemented in a 
framework that it is odd. 
 

>  My understanding is that we can redefine the application in  
>> wsgihandler.py, so create a wrapper over it. However, I am puzzle because I 
>> do not know what information is available at this stage (regarding 
>> pathinfo, etc.)  and where will I store the information that I need to pass 
>> to the wrapped application.
>>
>
> See https://www.python.org/dev/peps/pep-3333/#environ-variables. You 
> should be able to add items to the environment dictionary that ultimately 
> gets passed to gluon.main.wsgibase, which would then be available in 
> request.env.
>
>
Thank you. I have not looked at it yet, but it may be what I need. 
 

> Anyway, for simply setting some configuration options, this approach is 
> overkill. 
>


It maybe a complicated way to implement what, in my opinion, should be very 
easy to implement.  To return the same to you, I would say that "it's odd 
that it needs to be so complicated", just joking.

Dominic

-- 
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