Open GoogleCodeExporter opened 9 years ago
I had the exact same problem:
1. Extract google-app-engine-django
2. Link google_appengine as .google_appengine in the project directory
3. run python manage.py.runserver fails with importError in
appengine_django/__init__.py on line 109: 'from google.appengine.api import
apiproxy_stub_map'
This is because when executing line 56: ' from google.appengine.api import
apiproxy_stub_map', although the import fails, the 'google' module remains
cached in
sys.modules as some module added on PYTHONPATH by protobuf.
I got around this problem by removing the cached module after injecting
google.appengine packages in sys.path and reimporting:
===================================================================
--- appengine_django/__init__.py (revision 66)
+++ appengine_django/__init__.py (working copy)
@@ -106,6 +106,11 @@
# must come first to allow the local imports to override the SDK and
# site-packages directories.
sys.path = sys.path[0:1] + EXTRA_PATHS + sys.path[1:]
+ if sys.modules.has_key('google'):
+ old_mod = sys.modules['google']
+ del sys.modules['google']
+ import google
+ google.__path__ += old_mod.__path__
from google.appengine.api import apiproxy_stub_map
# Look for a zipped copy of Django.
===================================================================
Original comment by dorin.scutarasu@gmail.com
on 11 Jan 2009 at 5:42
Original issue reported on code.google.com by
evlogimenos
on 12 Oct 2008 at 1:23