django-nonrel / djangoappengine

Django backends for App Engine (datastore, mail, ...)
BSD 3-Clause "New" or "Revised" License
268 stars 79 forks source link

Import errors with GAE 1.6.4 on dev_appserver startup #23

Open aburgel opened 12 years ago

aburgel commented 12 years ago

it looks like some changes in GAE 1.6.4 broke how djangoappengine starts up when running locally.

djangoappengine mimics dev_appserver's module sys.path behavior, it add almost everything in SDK_ROOT/lib/ to sys.path following a simple heuristic. this no longer works because there are now two versions of webob, one for python2.5 and one for python2.7.

the simple fix is to check which version of python is running and add the right webob path. the better fix is to rely on dev_appserver to set sys.path, so we no longer have to keep up with their changes.

i'll put up the simple patch in a bit, it might take longer to get the more complicated one working, if its possible at all.

this is the exception in case anyone else runs into it.

Traceback (most recent call last):
  File "./manage.py", line 4, in <module>
    import settings # Assumed to be in the same directory.
  File "/Users/user/Documents/projects/xxx/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Users/user/Documents/projects/xxx/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/user/Documents/projects/xxx/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/user/Documents/projects/xxx/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/user/Documents/projects/xxx/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/user/Documents/projects/xxx/djangoappengine/management/commands/runserver.py", line 5, in <module>
    from django.db import connections
  File "/Users/user/Documents/projects/xxx/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Users/user/Documents/projects/xxx/django/db/utils.py", line 94, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/Users/user/Documents/projects/xxx/dbindexer/base.py", line 37, in DatabaseWrapper
    return Wrapper(settings_dict, *args, **kwargs)
  File "/Users/user/Documents/projects/xxx/dbindexer/base.py", line 22, in __init__
    super(BaseDatabaseWrapper, self).__init__(*args, **kwargs)
  File "/Users/user/Documents/projects/xxx/djangoappengine/db/base.py", line 114, in __init__
    stub_manager.setup_stubs(self)
  File "/Users/user/Documents/projects/xxx/djangoappengine/db/stubs.py", line 33, in setup_stubs
    self.setup_local_stubs(connection)
  File "/Users/user/Documents/projects/xxx/djangoappengine/db/stubs.py", line 69, in setup_local_stubs
    from google.appengine.tools import dev_appserver_main
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 157, in <module>
    from google.appengine.tools import appcfg
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 76, in <module>
    from google.appengine.tools import bulkloader
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 139, in <module>
    from google.appengine.ext.bulkload import bulkloader_config
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/__init__.py", line 40, in <module>
    import bulkload_deprecated
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/bulkload_deprecated.py", line 43, in <module>
    from google.appengine.ext import webapp
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/__init__.py", line 190, in <module>
    from webapp2 import *
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 25, in <module>
    import webob
ImportError: No module named webob
charettes commented 12 years ago

I edited your comment to wrap the traceback in a code block.

aburgel commented 12 years ago

this is mostly fixed by #24 but i think we could use a long term fix, so i'll leave this open.