change web2py application directory

324 views
Skip to first unread message

wiel

unread,
Oct 29, 2013, 2:04:26 PM10/29/13
to web...@googlegroups.com

I have a local repository and a web2py installation up. how can I change web2py's application directory so that it points to the repository? or how can I let web2py use the repository?

Richard Vézina

unread,
Oct 29, 2013, 4:55:06 PM10/29/13
to web2py-users
Symbolic link?

Richard


On Tue, Oct 29, 2013 at 2:04 PM, wiel <wiel...@gmail.com> wrote:

I have a local repository and a web2py installation up. how can I change web2py's application directory so that it points to the repository? or how can I let web2py use the repository?

--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Loïc

unread,
Oct 30, 2013, 4:06:22 AM10/30/13
to web...@googlegroups.com
Some weeks ago, I tried to create a symlink inside /applications folder, but I got an error in modules.
I was using mklink command on Win7, and my app works fine when located inside /applications folder without symlink...

Below is the ticket I got. Maybe you have an idea?

Ticket ID

127.0.0.1.2013-09-25.13-53-37.347db33f-279e-4ae1-b231-66904661519e
<type 'exceptions.ImportError'> No module named espern.modules.models_tools
Version
web2py™     Version 2.6.3-stable+timestamp.2013.09.15.17.01.20
Python     Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)
Traceback


Traceback (most recent call last):
  File "C:\Users\loic\web2py\gluon\restricted.py", line 217, in restricted
    exec ccode in environment
  File "C:/Users/loic/web2py/applications/espern/models/db_calendar.py", line 2, in <module>
    from models_tools import start_datetime, end_datetime
  File "C:\Users\loic\web2py\gluon\custom_import.py", line 86, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File "C:\Users\loic\web2py\gluon\custom_import.py", line 125, in __call__
    result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named espern.modules.models_tools

Richard Vézina

unread,
Oct 30, 2013, 9:52:21 AM10/30/13
to web2py-users
Hmmm... I pretty sure in linux a symlink would work, but in win it is different... If I remember there is a difference in hardlink and softlink that need to be consider...

Richard

Richard Vézina

unread,
Oct 30, 2013, 9:53:31 AM10/30/13
to web2py-users

Loïc

unread,
Oct 30, 2013, 10:11:40 AM10/30/13
to web...@googlegroups.com
I have found the problem. Thank you Richard!

For Windows users who want to move the applications subfolders out of web2py directory, the correct syntax is :
mklink /J TheLinkName ThePath

mklink /J created a directory junction
Previously, I used mklink /D (which creates a symlink for a folder) but this doesn't work.

Richard Vézina

unread,
Oct 30, 2013, 10:56:17 AM10/30/13
to web2py-users
Great!

:)

Richard

Richard Vézina

unread,
Oct 30, 2013, 11:01:44 AM10/30/13
to web2py-users
Loïc, just a thought... How will you manage the upgrade of web2py version? If you have only a single repo, you will make symlink in new version of web2py applications folder, but then you may face issue with the new version that force you to stick with previous version... If you have commit change over your trunk you will have to revert...

I generally just copy my entire repo, that become a clone...

Richard

Loïc ESPERN

unread,
Oct 30, 2013, 1:18:17 PM10/30/13
to web...@googlegroups.com

Good idea
I will make a try when upgrading my web2py repo...

Thank you

You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/3FWZCmLzhzc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Loïc

unread,
Oct 31, 2013, 5:12:58 AM10/31/13
to web...@googlegroups.com, lo...@espern.net
For Windows users who are interested...

Now I have 2 separate folders :

|_web2py (containing web2py source files with default applications)
   |_...  
   |_applications
      |_admin
      |_welcome
  
|_web2py_apps (folder containing all my apps)
   |_app1
   |_app2
   |_...

When I upgrade web2py , I replace the whole "web2py" folder
Then I launch a little batch file stored in "web2py_apps" to recreate all directory junctions.
Code here :

create_junctions.bat
for /f "delims=" %%a In ('dir /ad/b  "./" ') Do mklink /J ..\web2py\applications\%%a .\%%a
pause

Kiran Subbaraman

unread,
Oct 31, 2013, 6:09:20 AM10/31/13
to web...@googlegroups.com, lo...@espern.net
Loic,
I find this to be useful, primarily because I want to add just my web2py applications to source control, and not necessarily the web2py installation. Also, am developing this stuff on windows, and actually deploy it on ubuntu. I feel this separation of my apps from the web2py platform is useful in this sense too.
Some details like:
* Where to run the script from
* Also an additional step would be to script the wget of the web2py install, and follow that up with this script automatically. This is something that could be contributed later on...

Possible for you to add this to web2py slices, as a recipe? (http://www.web2pyslices.com/home).
Thank you.
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On 10/31/2013 2:42 PM, Lo�c wrote:
For Windows users who are interested...

Now I have 2 separate folders :

|_web2py (containing web2py source files with default applications)
�� |_... �
�� |_applications
����� |_admin
����� |_welcome
��
|_web2py_apps (folder containing all my apps)
�� |_app1
�� |_app2
�� |_...


When I upgrade web2py , I replace the whole "web2py" folder
Then I launch a little batch file stored in "web2py_apps" to recreate all directory junctions.
Code here :

create_junctions.bat
for /f "delims=" %%a In ('dir /ad/b �"./" ') Do mklink /J ..\web2py\applications\%%a .\%%a
pause



Le mercredi 30 octobre 2013 18:18:17 UTC+1, Lo�c ESPERN a �crit�:

Good idea
I will make a try when upgrading my web2py repo...

Thank you

Le 30 oct. 2013 16:01, "Richard V�zina" <ml.richa...@gmail.com> a �crit :
Lo�c, just a thought... How will you manage the upgrade of web2py version? If you have only a single repo, you will make symlink in new version of web2py applications folder, but then you may face issue with the new version that force you to stick with previous version... If you have commit change over your trunk you will have to revert...

I generally just copy my entire repo, that become a clone...

Richard
On Wed, Oct 30, 2013 at 10:56 AM, Richard V�zina <ml.richa...@gmail.com> wrote:
Great!

:)

Richard


On Wed, Oct 30, 2013 at 10:11 AM, Lo�c <loic....@gmail.com> wrote:
I have found the problem. Thank you Richard!

For Windows users who want to move the applications subfolders out of web2py directory, the correct syntax is :
mklink /J TheLinkName ThePath

mklink /J created a directory junction
Previously, I used mklink /D (which creates a symlink for a folder) but this doesn't work.




Le mercredi 30 octobre 2013 14:53:31 UTC+1, Richard a �crit�:


On Wed, Oct 30, 2013 at 9:52 AM, Richard V�zina <ml.richa...@gmail.com> wrote:
Hmmm... I pretty sure in linux a symlink would work, but in win it is different... If I remember there is a difference in hardlink and softlink that need to be consider...

Richard
On Wed, Oct 30, 2013 at 4:06 AM, Lo�c <loic....@gmail.com> wrote:
Some weeks ago, I tried to create a symlink inside /applications folder, but I got an error in modules.
I was using mklink command on Win7, and my app works fine when located inside /applications folder without symlink...

Below is the ticket I got. Maybe you have an idea?

Ticket ID

127.0.0.1.2013-09-25.13-53-37.347db33f-279e-4ae1-b231-66904661519e
<type 'exceptions.ImportError'> No module named espern.modules.models_tools
Version
web2py����� Version 2.6.3-stable+timestamp.2013.09.15.17.01.20
Python���� Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)

Traceback


Traceback (most recent call last):
� File "C:\Users\loic\web2py\gluon\restricted.py", line 217, in restricted
��� exec ccode in environment
� File "C:/Users/loic/web2py/applications/espern/models/db_calendar.py", line 2, in <module>
��� from models_tools import start_datetime, end_datetime
� File "C:\Users\loic\web2py\gluon\custom_import.py", line 86, in custom_importer
��� return base_importer(pname, globals, locals, fromlist, level)
� File "C:\Users\loic\web2py\gluon\custom_import.py", line 125, in __call__
��� result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)

ImportError: No module named espern.modules.models_tools

Le mardi 29 octobre 2013 21:55:06 UTC+1, Richard a �crit�:

Richard Vézina

unread,
Oct 31, 2013, 9:58:16 AM10/31/13
to web2py-users
Loïc, what I was saying is that you will get in trouble when you upgrade web2py with this scenario... Migration from version of web2py to another is sometime not straigh as it should and you found yourself having to go back an forth between both version. In this situation you have sometime to make changes to your app that are not backward compatible so you can't have only one copy of your app in this case at least if you want to be flexible... What I do is to copy my repo from one web2py version to another. My setup is like this :

programmation/version_246/web2py/applications/myapp
programmation/version_247/web2py/applications/myapp
programmation/version_274/web2py/applications/myapp

myapp in each of these web2py version is a clone from the precedent version of web2py. When I feel confortable that I will migrate definitly to a new version I leave the old app behind that sit. It is not that clean, but it had prove to be effective... And if I want to make cleanup I just have to delete the old web2py version tree to make space.

Hope it help.

Richard






On Thu, Oct 31, 2013 at 6:09 AM, Kiran Subbaraman <subbaram...@gmail.com> wrote:
Loic,
I find this to be useful, primarily because I want to add just my web2py applications to source control, and not necessarily the web2py installation. Also, am developing this stuff on windows, and actually deploy it on ubuntu. I feel this separation of my apps from the web2py platform is useful in this sense too.
Some details like:
* Where to run the script from
* Also an additional step would be to script the wget of the web2py install, and follow that up with this script automatically. This is something that could be contributed later on...

Possible for you to add this to web2py slices, as a recipe? (http://www.web2pyslices.com/home).
Thank you.
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On 10/31/2013 2:42 PM, Loïc wrote:
For Windows users who are interested...

Now I have 2 separate folders :

|_web2py (containing web2py source files with default applications)
   |_...  
   |_applications
      |_admin
      |_welcome

  
|_web2py_apps (folder containing all my apps)
   |_app1
   |_app2

   |_...

When I upgrade web2py , I replace the whole "web2py" folder
Then I launch a little batch file stored in "web2py_apps" to recreate all directory junctions.
Code here :

create_junctions.bat
for /f "delims=" %%a In ('dir /ad/b  "./" ') Do mklink /J ..\web2py\applications\%%a .\%%a
pause



Le mercredi 30 octobre 2013 18:18:17 UTC+1, Loïc ESPERN a écrit :

Good idea
I will make a try when upgrading my web2py repo...

Thank you

Le 30 oct. 2013 16:01, "Richard Vézina" <ml.richa...@gmail.com> a écrit :
Loïc, just a thought... How will you manage the upgrade of web2py version? If you have only a single repo, you will make symlink in new version of web2py applications folder, but then you may face issue with the new version that force you to stick with previous version... If you have commit change over your trunk you will have to revert...
Great!

:)

Richard


web2py™     Version 2.6.3-stable+timestamp.2013.09.15.17.01.20
Python     Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)

Traceback


Traceback (most recent call last):
  File "C:\Users\loic\web2py\gluon\restricted.py", line 217, in restricted
    exec ccode in environment

  File "C:/Users/loic/web2py/applications/espern/models/db_calendar.py", line 2, in <module>
    from models_tools import start_datetime, end_datetime
  File "C:\Users\loic\web2py\gluon\custom_import.py", line 86, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File "C:\Users\loic\web2py\gluon\custom_import.py", line 125, in __call__
Reply all
Reply to author
Forward
0 new messages