我为AppEngine配置了一个Dart Managed VM,如 tutorial所述.它已经过时,仍然使用现在删除的gcloud预览应用程序而不是dev_appserver.py.我发现其他人成功使用dev_appserver.py用于Dart VM,但是我收到以下错误:
$dev_appserver.py app.yaml --runtime custom
INFO 2015-12-11 12:19:50,907 application_configuration.py:431] No version specified. Generated version id: 20151211t121950
INFO 2015-12-11 12:19:50,908 devappserver2.py:769] Skipping SDK update check.
INFO 2015-12-11 12:19:50,939 api_server.py:205] Starting API server at: http://localhost:36858
INFO 2015-12-11 12:19:50,951 api_server.py:648] Applying all pending transactions and saving the datastore
INFO 2015-12-11 12:19:50,951 api_server.py:651] Saving search indexes
Traceback (most recent call last):
File "/opt/google/cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "/opt/google/cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
main()
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
dev_server.start(options)
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 824, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
_module.start()
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1548, in start
self._add_instance()
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1700, in _add_instance
expect_ready_request=True)
File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/custom_runtime.py", line 83, in new_instance
assert self._runtime_config_getter().custom_config.custom_entrypoint
AssertionError
我的Dockerfile已就绪,app.yaml是正确的.我在IntelliJ中创建了一个示例Dart AppEngine项目,并使用教程检查了创建文件的内容.
This post from the e-mail list建议使用–custom_entrypoint选项.我试过了,但得到了这个错误信息.在调用Dart入口点之前,似乎应用程序服务器正在声明端口.
$dev_appserver.py app.yaml --custom_entrypoint "dart bin/server.dart --port=8080"
INFO 2015-12-11 12:41:13,334 application_configuration.py:431] No version specified. Generated version id: 20151211t124113
INFO 2015-12-11 12:41:13,334 devappserver2.py:769] Skipping SDK update check.
INFO 2015-12-11 12:41:13,363 api_server.py:205] Starting API server at: http://localhost:44617
INFO 2015-12-11 12:41:13,375 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2015-12-11 12:41:13,376 admin_server.py:116] Starting admin server at: http://localhost:8000
Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 98), address = 0.0.0.0, port = 8080
#0 _NativeSocket.bind.<anonymous closure> (dart:io-patch/socket_patch.dart:494)
#1 _rootRunUnary (dart:async/zone.dart:914)
#2 _CustomZone.runUnary (dart:async/zone.dart:810)
#3 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
#4 _Future._propagateToListeners (dart:async/future_impl.dart:585)
#5 _Future._completeWithValue (dart:async/future_impl.dart:376)
#6 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:430)
#7 _rootRun (dart:async/zone.dart:907)
#8 _CustomZone.run (dart:async/zone.dart:802)
#9 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:735)
#10 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#11 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#12 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
^CTraceback (most recent call last):
File "/opt/google/cloud-sdk/bin/dev_appserver.py", line 35, in <module>
main()
File "/opt/google/cloud-sdk/bin/dev_appserver.py", line 29, in main
os.path.join('platform', 'google_appengine'), 'dev_appserver.py', *args)
File "/opt/google/cloud-sdk/bin/bootstrapping/bootstrapping.py", line 45, in ExecutePythonTool
execution_utils.ArgsForPythonTool(_FullPath(tool_dir, exec_name), *args))
File "/opt/google/cloud-sdk/bin/bootstrapping/bootstrapping.py", line 86, in _ExecuteTool
execution_utils.Exec(args + sys.argv[1:], env=_GetToolEnv())
File "/opt/google/cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 209, in Exec
INFO 2015-12-11 12:41:37,298 shutdown.py:45] Shutting down.
ret_val = p.wait()
File "/usr/lib64/python2.7/subprocess.py", line 1384, in wait
INFO 2015-12-11 12:41:37,298 api_server.py:648] Applying all pending transactions and saving the datastore
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib64/python2.7/subprocess.py", line 476, in _eintr_retry_call
return func(*args)
KeyboardInterruptINFO 2015-12-11 12:41:37,298 api_server.py:651] Saving search indexes
最佳答案 该教程已过时,您不能再这样做了.
原因是您正在使用自定义运行时(教程中的app.yaml具有运行时:自定义).
自定义运行时无法再在开发服务器上运行! (见this answer)
可以运行应用程序,但您必须部署到App Engine服务器.