I'm attempting to use the command dev_appserver.py ./
from my application directory, but it's throwing the following error.
ERROR 2016-01-04 04:47:51,421 wsgi.py:263]
Traceback (most recent call last):
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/Joshua/Projects/inkren/skritter-api/main.py", line 2, in <module>
from gcloud import datastore
ImportError: No module named gcloud
I'm running a virtualenv that has gcloud installed and also have the gcloud sdk installed with the proper python component. The gcloud library is found when I run python ./main.py
.
# main.py
import webapp2
from gcloud import datastore
class MainPage(webapp2.RequestHandler):
def get(self):
client = datastore.Client(dataset_id='my-project')
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
What I'd like to do is be able to run my code locally in the browser. Is there a way to get dev_appserver.py
to recognize the gcloud library?