views:

70

answers:

3

Hello,

I understand that if you want to include external packages you have to include them in your project. So I was wondering how do you do this?

Do people use one general script that auto imports them from a location. Maybe some kind of config file that lists all the external packages? Do you always zip the packages and use zipimporter?

Anway, I guess I am looking for a good general strategy for import external packages. I learned some already from looking at source code but extra info/examples would be super.

A: 

Jaikuengine use a good solution in my point of view.

It use a directory "vendor" with all dependencies and at start the application zips all packages in the directory and updates the sys path.

For more informations see on jaikuengine project http://goo.gl/wX5P:

svn/trunk/manage.py
svn/trunk/build.py
svn/trunk/vendor/

Also the importante point is, in app.yaml the directory vendor is skipped and just the libs.zip are uploaded into appengine.

sahid
A: 

if you have modules or eggs in your scripts directory these can be imported like modules for example if i wanted to use PyRTF on Google app engine i would copy the PyRTF folder from my computer into my projects root directory, this will only work with pure-python modules though

also you can make your own modules, python will import folders as modules if they fit the structure

<foldername>
-"__init__.py"
-"someotherscript.py"

and can then be imported as import foldername

Hugoagogo
+1  A: 

Just place the package's folder in the root directory of your GAE application, easy!

Noah McIlraith