Failed to start dev_appserver.py with gcloud

I try to use a command dev_appserver.py ./from my application directory, but it throws 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 am running virtualenv that has gcloud installed and also gcloud sdk is installed with the corresponding python component. The gcloud library is detected at startup 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 would like to do is run my code locally in a browser. Is there any way to get dev_appserver.pygcloud library recognition?

0
source share
2 answers

Is python development server from gcloud still using the problem? I successfully use dev_appserver.pyfrom the terminal. See link .

, setup . , dev_appserver.py Windows, .

+1

, ... , .

GitHub . https://github.com/dhermes/test-gcloud-on-gae

/ , gcloud.

1) application vendor . gcloud, . , .

2) appengine_config.py . , .

3) darth.py . .

, . , . , !

, . , python , , C.

0

Source: https://habr.com/ru/post/1655849/


All Articles