Hi George,
So I did see that question on Stack overflow, but I could not reproduce
the behaviour:
I added:
if(BaseHandler.isDevAppServer()):
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.datastore.entity_pb import Reference
remote_api_stub.ConfigureRemoteApi(app_id=None, path='/_ah/remote_api',
auth_func=lambda:
('[email protected]', 'mypassword'),
servername='appid.appspot.com')
if os.environ['SERVER_SOFTWARE'].startswith('Development'):
Reference.app = lambda *args:
os.environ['APPLICATION_ID'].replace('dev~', 's~')
To my appengine_config.py (I also changed the appid.appspot.com to my
application id.appspot.com) but in both cases I got the following error:
Traceback (most recent call last):
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py",
line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py",
line 351, in __getattr__
self._update_configs()
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py",
line 287, in _update_configs
self._registry.initialize()
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py",
line 160, in initialize
import_func(self._modname)
File "/home/fcaldas/lipex/webapp_lipex/appengine_config.py", line 31, in
<module>
servername='appid.appspot.com')
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
line 881, in ConfigureRemoteApi
app_id = GetRemoteAppIdFromServer(server, path, rtok)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
line 586, in GetRemoteAppIdFromServer
response = server.Send(path, payload=None, **urlargs)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc.py",
line 393, in Send
f = self.opener.open(req)
File "/usr/lib64/python2.7/urllib2.py", line 435, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 473, in error
return self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
INFO 2017-11-23 09:17:14,153 module.py:821] default: "GET / HTTP/1.1"
500 -
I do have the remote_api on and I use multiple CRON scripts to load data
into the datastore running on Virtual machines, on those scripts I normally
simply use:
from google.appengine.ext.remote_api import remote_api_stub
PROJECT_ID = "myprojectID"
remote_api_stub.ConfigureRemoteApiForOAuth(
'{}.appspot.com'.format(PROJECT_ID),
'/_ah/remote_api/')
But adding that to my appengine_config gives the following errors:
fcaldas@trinity:~/lipex/webapp_lipex$ dev_appserver.py app.yaml
INFO 2017-11-23 09:23:14,125 devappserver2.py:105] Skipping SDK update
check.
INFO 2017-11-23 09:23:19,250 api_server.py:300] Starting API server at:
http://localhost:38963
INFO 2017-11-23 09:23:19,286 dispatcher.py:251] Starting module
"default" running at: http://localhost:8080
INFO 2017-11-23 09:23:19,287 admin_server.py:116] Starting admin server
at: http://localhost:8000
INFO 2017-11-23 09:23:28,484 transport.py:157] Attempting refresh to
obtain initial access_token
INFO 2017-11-23 09:23:28,487 client.py:755] Refreshing access_token
ERROR 2017-11-23 09:23:38,957 Applicant.py:25] Could not import
google.cloud.bigquery
ERROR 2017-11-23 09:23:38,963 Trademark.py:33] Could not import
google.cloud.bigquery
ERROR 2017-11-23 09:23:39,031 Applicant.py:25] Could not import
google.cloud.bigquery
ERROR 2017-11-23 09:23:39,034 Trademark.py:33] Could not import
google.cloud.bigquery
ERROR 2017-11-23 09:23:39,322 PubSub.py:15] Could not import PubSub:
watch reports will not work. (PubSub.py)
LOG 0 1511429019436934 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019437051 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '602',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019437414 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019437465 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '1031',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019437716 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019437761 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '1461',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019437980 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019438023 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '1891',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019438242 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019438284 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '2321',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019438521 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019438568 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '2751',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019438798 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019438844 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '3181',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019439237 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019439308 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '3611',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019439642 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019439716 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '4041',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019440161 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019440234 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '4471',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019440775 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019440892 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '4901',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019441860 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019441960 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '5331',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019442334 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019442386 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '5761',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019442668 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019442718 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '6191',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019442979 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019443025 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '6621',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019443358 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019443407 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '7051',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019443658 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019443702 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '7481',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019443944 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019443990 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '7911',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019444236 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019446394 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019446439 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '11354',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019446692 _Authenticate configuring auth; needs_auth=False
LOG 0 1511429019446734 Sending request to
https://lipexdb-test.appspot.com/_ah/remote_api/
headers={'X-appcfg-api-version': '1', 'content-length': '11785',
'Content-Type': 'application/octet-stream'} body=ELIDED
LOG 0 1511429019450336 _Authenticate configuring auth; needs_auth=False
.........
many lines later:
.........
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/gae_override/httplib.py",
line 522, in getresponse
**extra_kwargs)
File "/home/fcaldas/lipex/webapp_lipex/libs/httplib2/__init__.py", line
1106, in fixed_fetch
validate_certificate=validate_certificate)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py",
line 293, in fetch
return rpc.get_result()
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py",
line 613, in get_result
return self.__get_result_hook(self)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py",
line 413, in _get_fetch_result
rpc.check_success()
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py",
line 579, in check_success
self.__rpc.CheckSuccess()
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_rpc.py",
line 157, in _WaitImpl
self.request, self.response)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
line 203, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
line 228, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py",
line 240, in Send
self._Authenticate(self.http, auth_errors[0] > 0)
File
"/home/fcaldas/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py",
line 471, in _Authenticate
needs_auth)
File "/usr/lib64/python2.7/logging/__init__.py", line 1155, in debug
self._log(DEBUG, msg, args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1285, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args,
exc_info, func, extra)
File "/usr/lib64/python2.7/logging/__init__.py", line 1259, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
File "/usr/lib64/python2.7/logging/__init__.py", line 263, in __init__
if (args and len(args) == 1 and isinstance(args[0], collections.Mapping)
File "/usr/lib64/python2.7/abc.py", line 132, in __instancecheck__
if subclass is not None and subclass in cls._abc_cache:
RuntimeError: maximum recursion depth exceeded
Thanks for your support
On Wednesday, 22 November 2017 17:49:21 UTC, George (Cloud Platform
Support) wrote:
>
> Hello Filipe,
>
> It is indeed possible to connect the dev_appserver to your production
> datastore. This has to be done in a way similar to what you already tried,
> by modifying appengine_config.py to call
> remote_api_stub.ConfigureRemoteApi(app_id=None, path='/_ah/remote_api',
> auth_func=lambda: ('email', 'password'),
> servername='appid.apps fpot.com') . More related detail may be gathered
> from the replies to the "Is it possible to run dev_appserver.py with the
> remote datastore?" question
> <https://stackoverflow.com/questions/22214258/is-it-possible-to-run-dev-appserver-py-with-the-remote-datastore>
>
> on stackoverflow.
>
> When you say that your attempt did not work, what were the errors? How did
> that fail, exactly?
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/919962a3-1fe1-48d0-8327-a4b7f207157e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.