Using python 2.7 and Google app engine I am building a website composed of multiple modules.
By that I mean that I am looking to build each module in an app like fashion.
To achieve my goal I have set up multiple *.yaml files using the includes (https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Includes). It seems to do what I want until... none of the secondary modules are loaded... I could play around with the 'import' loader in python locally, but I am looking for something less hacky that would work with the app engine deployer (and on the Google server). Basically my problem is that I do not know how to 'include' all python modules (as they live in separate directories as ruled by different yaml). I looked over on the doc and it does not seem to be explained.
I am NOT looking to run them as separated modules, which could be a way of handling it. I could be opened to it but I run into a similar situation with that approach though: how to I include/package the common code in each module?
As I have nothing working I did not include sample code or yaml.
Thank you for your help!
@TimHoffman & @EzequielMuns
Thank you, I implemented the change suggested:
import os
import sys
sys.path.append("[absolute_path_to_be_sure]/used_app")
And got:
File "[...]/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 903, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named DefaultHandler
Seems the sandboxing gets in the way (the function that returns this seems hard coded).
The Defaulthandler is a python class that live in a module at the root of used_app. I got the error trying to import it.
My directory structure is as follows:
- main_app - app.yaml - MyApp.py - Handler.py - used_app - DefaultHandler.py - include.yaml (though I am not sure it is useful to me right now)
Where Handler inherits DefaultHandler for example.