I have a Python module containing some utils that all my GAE applications may use. I created it myself. It is n a separate folder and I sometimes want to update its code, make refactorings etc. Every application I create, can take use functions from this module. Now I need to copy the module folder somewhere inside an application and import its functions. It's an ordinary procedure, nothing fancy. When I make some updates to the code of the module, I then need to overwrite this module if it is already imported in the application. Then I just deploy the application with GAE utility and all works fine. The question is - Is that possible to not have many copies of the module in every application having to overwrite them all every time I update some code inside that, but have one copy in one place and automatically import it from there? I know I can copy the module code somewhere Python searches for modules. Though, I still need to copy this module folder into the application when I deploy it into GAE environment. So, I need one copy of a module accessible for all my application when they are on my local PC and need to have that folder copied into the app when I deploy it. Is there a good and nice solution? Thanks.
Asked
Active
Viewed 411 times
1 Answers
4
You can store your module in a directory outside all your GAE apps and then create a symbolic link to that directory inside all the GAE apps directories. appcfg.py
will follow the symbolic link. Quoting from the Python SDK docs:
If you make a symbolic link to a module's directory in your application directory, appcfg.py will follow the link and include the module in your app.

Andrea Spadaccini
- 12,378
- 5
- 40
- 54
-
Wow, I never knew I could use an absolutely different way. It works like a charm. Now it seems that I get rid of additional routines with copying and overwriting files. Thanks! – Sergei Basharov Mar 28 '11 at 13:08
-
@Sergey you are welcome. ;) Don't forget to accept the answer if you feel that your problem is now solved :D – Andrea Spadaccini Mar 28 '11 at 13:21
-
You could also use version control - for example, a git subrepo. – Nick Johnson Mar 28 '11 at 23:58