配置Google App Engine SDK以供离线使用

时间:2012-02-20 16:42:52

标签: python google-app-engine networking

如何配置Google App Engine SDK以运行本地开发服务器而无需网络连接?我尝试在运行时删除~/.appcfg_nag并设置--skip_sdk_update_check,但它仍然失败并出现以下错误:

socket.gaierror: [Errno 8] nodename nor servname provided, or not known

编辑:这是完整的命令和错误输出:

$ dev_appserver.py helloworld/
INFO     2012-02-20 20:00:19,712 py_zipimport.py:148] zipimporter('/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-fat.egg', 'MySQLdb/')
WARNING  2012-02-20 20:00:19,784 rdbms_mysqldb.py:94] The rdbms API is not available because the MySQLdb library could not be loaded.
Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production.
INFO     2012-02-20 20:00:19,859 appengine_rpc.py:159] Server: appengine.google.com
WARNING  2012-02-20 20:00:19,874 dev_appserver.py:3396] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
Traceback (most recent call last):
  File "/usr/local/bin/dev_appserver.py", line 99, in <module>
    run_file(__file__, globals())
  File "/usr/local/bin/dev_appserver.py", line 95, in run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 692, in <module>
    sys.exit(main(sys.argv))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 656, in main
    persist_logs=persist_logs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3594, in CreateServer
    server = HTTPServerWithScheduler((serve_address, port), handler_class)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3622, in __init__
    request_handler_class)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 400, in __init__
    self.server_bind()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 411, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

1 个答案:

答案 0 :(得分:1)

默认行为是绑定到127.0.0.1,通过在/ etc / hosts上查找它来解析为“localhost”(反之亦然)。尝试通过将其作为“dev_appserver.py helloworld -a 127.0.0.1 -p 8080”启动来强制绑定到127.0.0.1:8080,或者使用“dev_appserver.py helloworld -a 0.0.0.0 -p 8080将其绑定到所有本地地址” “看看会发生什么。