Was working while setup in a samples dir downloaded from github, but now that I've built my own API, the dev server starts but throws this error when hitting it with CURL:
$ dev_appserver.py ./app.yaml
INFO 2019-03-31 21:48:38,215 api_server.py:275] Starting API server at: http://localhost:54462
INFO 2019-03-31 21:48:38,225 api_server.py:265] Starting gRPC API server at: http://localhost:54464
WARNING 2019-03-31 21:48:38,227 dispatcher.py:338] Your python27 micro version is below 2.7.12, our current production version.
INFO 2019-03-31 21:48:38,386 dispatcher.py:256] Starting module "default" running at: http://localhost:8080
INFO 2019-03-31 21:48:38,395 admin_server.py:150] Starting admin server at: http://localhost:8000
INFO 2019-03-31 21:48:48,055 instance.py:294] Instance PID: 96100
INFO 2019-03-31 21:48:48,076 module.py:861] default: "GET /_ah/start HTTP/1.1" 404 -
ERROR 2019-03-31 21:48:48,113 wsgi.py:263]
Traceback (most recent call last):
File "/Users/me/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/me/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/me/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/me/Documents/GitHub/activitylogs_api/main.py", line 19, in <module>
import endpoints
ImportError: No module named endpoints
INFO 2019-03-31 21:48:48,120 module.py:861] default: "GET /_ah/api/activitylogs/v1/list HTTP/1.1" 500 -
However python -m pip list shows these:
google-endpoints 4.8.0
google-endpoints-api-management 1.11.0
Does the dev server run under the context of some other environment? It was working while in a different samples folder but not here. There's also a ./lib folder with the requirements installed by this command:
pip install --target lib --requirement requirements.txt --ignore-installed
which of course, includes endpoints...
$ gcloud version
Google Cloud SDK 237.0.0
app-engine-python 1.9.83
app-engine-python-extras 1.9.74
beta 2019.02.22
bq 2.0.42
cloud-datastore-emulator 2.1.0
core 2019.03.01
gsutil 4.37
kubectl 2019.03.01
Here is (the beginning of) main.py:
# [START imports]
import endpoints
from endpoints import message_types
from endpoints import messages
from endpoints import remote
from datetime import datetime
# [END imports]
What's interesting is that if I enter python and try the import I get a different error:
$ python
Python 2.7.10 (default, Feb 22 2019, 21:17:52)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import endpoints
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/me/Library/Python/2.7/lib/python/site-packages/endpoints/__init__.py", line 25, in <module>
from protorpc import message_types
ImportError: No module named protorpc
>>>
Whereas python3 shows the same error the dev appserver is showing. But I don't see how it could be starting the appengine server as python3 because app.yaml has this:
runtime: python27