[web2py] Re: Set/change modules folder location for an app

2011-12-03 Thread Alan Etkin
Perfect. I thought there was need for that extra file. Thanks On Dec 2, 6:50 pm, Massimo Di Pierro wrote: > You can do it in routes.py > > import sys > sys.path.append(...) > > that file is executed only once. > > On Dec 2, 5:47 am, Alan Etkin wrote: > > > Suppose now that i dont feel like chan

[web2py] Re: Set/change modules folder location for an app

2011-12-02 Thread Massimo Di Pierro
You can do it in routes.py import sys sys.path.append(...) that file is executed only once. On Dec 2, 5:47 am, Alan Etkin wrote: > Suppose now that i dont feel like changing the web2py.py script > because it is something like a framework's specific file. Then i think > it would be nice to be ab

[web2py] Re: Set/change modules folder location for an app

2011-12-02 Thread Alan Etkin
Suppose now that i dont feel like changing the web2py.py script because it is something like a framework's specific file. Then i think it would be nice to be able to specify extra system routes to add to the path on web service initialization, in an app specific way. How about an extrapaths file s

[web2py] Re: Set/change modules folder location for an app

2011-12-02 Thread Alan Etkin
What do you know... i found this in Stackoverflow, wich covers my question: " ... In any multi-threaded Python program (and not only Python) you should not use os.chdir and you should not change sys.path when you have more than one thread running. It is not safe because it affects other threads. M

[web2py] Re: Set/change modules folder location for an app

2011-12-02 Thread Alan Etkin
The symbolic link approach seems to me to be more interesting than modifying web2py.py, but i do not see why the sys.path.append thing at application code is not recomended. I'll have to search on that topic. Thanks again for the support On Dec 2, 2:04 am, Massimo Di Pierro wrote: > you can crea

[web2py] Re: Set/change modules folder location for an app

2011-12-01 Thread Massimo Di Pierro
you can create symbolic link to the web2py/site-packages folder or you can add a sys.path.append to web2py.py On Dec 1, 9:14 pm, Alan Etkin wrote: > The required modules are stored outside the web2py folder because they > are shared by a non web2py app. So i cannot import them with that > method

[web2py] Re: Set/change modules folder location for an app

2011-12-01 Thread Alan Etkin
The required modules are stored outside the web2py folder because they are shared by a non web2py app. So i cannot import them with that method. I know i could just copy them into the app's modules folder and that would be it, But i do not want to duplicate files. On Dec 1, 11:19 am, Anthony wrot

[web2py] Re: Set/change modules folder location for an app

2011-12-01 Thread Anthony
On Thursday, December 1, 2011 8:58:03 AM UTC-5, Alan Etkin wrote: > > >Instead making local_import("model") for a model stored at myweb2pyapp/ > >models/model.py, i need to make the same statement for a model stored > >at ~/another/path/module.py > > I meant import modules, sorry for the mistake. >

[web2py] Re: Set/change modules folder location for an app

2011-12-01 Thread Alan Etkin
>Instead making local_import("model") for a model stored at myweb2pyapp/ >models/model.py, i need to make the same statement for a model stored >at ~/another/path/module.py I meant import modules, sorry for the mistake. So to import a module from another path i could do: from gluon.custom_import

[web2py] Re: Set/change modules folder location for an app

2011-12-01 Thread Anthony
First, you don't import models -- they are automatically executed by the framework. Instead, you import modules (which can be anywhere in the usual Python sys.path, or in your application's /modules folder). Also, local_import has been deprecated. You can now import modules from your applicatio