How to disable Google App Engine python SDK import hook?
Question: I am playing around with local deployment of GAE python SDK. The code that I
am trying to run contains many external libraries which are not part of GAE
import whitelist. I want to disable the import restrictions and let GAE app
import any locally installed module.

After walking through the code, I figured out that they use custom **import
hooks** for restricting imports. However, I have not been able to figure out
how to disable the overridden import hook.

Let me know if you have any idea how this can be accomplished.


Answer: Easiest thing is to modify google/appengine/tools/dev_appserver_import_hook.py
and add the module you want to the whitelist.

This will allow you to import whatever you want.

Now there's a good reason that the imports are restricted in the development
server. The restricted imports match what's available on the production
environment. So if you add libraries to the whitelist, your code may run on
your local development server, but it will not run on the production
environment.

And no, you can't import restricted modules on production.

