0

I tried to make a simple application "guestbook" that stores the messages in the drive of the author. I use the libraries "httplib2", "apiclient" "," UriTemplate ". Google app engine does not support these libraries so I have included in my project. I started using webapp2 and worked very well. Now I try to spend a Django but I do not know where to put my libraries. anywhere I put them I get a "ImportError." So my question is simple, how do I include my libraries in django?

ImportError: cannot import name httplib2

Internal Server Error: /
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/handlers/base.py", line 101, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 340, in resolve
    sub_match = pattern.resolve(new_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 224, in resolve
    return ResolverMatch(self.callback, args, kwargs, self.name)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 231, in callback
    self._callback = get_callable(self._callback_str)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/utils/functional.py", line 31, in wrapper
    result = func(*args)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 98, in get_callable
    mod = import_module(mod_name)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/mouaderraji/Desktop/gae-workspace/guestbook/guestbookdrive/views.py", line 5, in <module>
    from guestbook import httplib2
ImportError: cannot import name httplib2
ERROR    2014-07-02 18:15:09,645 base.py:210] Internal Server Error: /
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/handlers/base.py", line 101, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 340, in resolve
    sub_match = pattern.resolve(new_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 224, in resolve
    return ResolverMatch(self.callback, args, kwargs, self.name)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 231, in callback
    self._callback = get_callable(self._callback_str)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/utils/functional.py", line 31, in wrapper
    result = func(*args)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/urlresolvers.py", line 98, in get_callable
    mod = import_module(mod_name)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/mouaderraji/Desktop/gae-workspace/guestbook/guestbookdrive/views.py", line 5, in <module>
    from guestbook import httplib2
ImportError: cannot import name httplib2
INFO     2014-07-02 18:15:09,748 module.py:639] default: "GET / HTTP/1.1" 500 77550
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • I've edited your question title, as this is very definitely a question about GAE, not about Django. – Daniel Roseman Jul 02 '14 at 18:30
  • IINM, HTTP is one of the things you are forbid to do directly when hosting on GAE. You must use a GAE provided API instead. – Paulo Scardine Jul 02 '14 at 18:33
  • in which directory is your `app.yaml`? If in `guestbook`, just use `import httplib2` – GAEfan Jul 02 '14 at 18:39
  • at GAEfan, I have two folder named guestbook ( the project, and the app that contain settings). here is the hierarchy of my project, so you can tell me exactly where to put my library : guestbook -guestbook -- __init__.py -- settings.py -- urls.py -- wsgi.py -guestbookdrive -- __init__.py -- models.py -- views.py - app.yaml - manage.py - __init__.py @PauloScardine, Ok how to do it ? if you have a doc or a tutorial it gonna help me. – user3798827 Jul 03 '14 at 09:39
  • AFAIK you are not allowed to fetch documents in from the web in GAE unless using a blessed api https://developers.google.com/appengine/docs/python/urlfetch/ – Paulo Scardine Jul 03 '14 at 12:11

0 Answers0