我想在虚拟环境中本地运行我的GAE应用程序.
我已经按照这两篇文章[1],[2]作为设置的参考,但是当我获取evn / bin / activate然后dev_appserver.py.时,它不断引发ImportError的错误:没有名为warnings的模块(下面有更多描述)
令人惊讶的是,如果我通过运行dev_appserver.py来启动它而不激活虚拟环境.项目的内部根目录运行没有任何问题.
这个问题有什么解决方案或解决方法吗?
INFO 2017-08-31 14:09:36,293 devappserver2.py:116] Skipping SDK update check.
INFO 2017-08-31 14:09:36,354 api_server.py:313] Starting API server at: http://localhost:52608
INFO 2017-08-31 14:09:36,357 dispatcher.py:226] Starting module "default" running at: http://localhost:8080
INFO 2017-08-31 14:09:36,359 admin_server.py:116] Starting admin server at: http://localhost:8000
Traceback (most recent call last):
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/_python_runtime.py", line 103, in <module>
_run_file(__file__, globals())
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/_python_runtime.py", line 97, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime.py", line 192, in <module>
main()
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime.py", line 172, in main
sandbox.enable_sandbox(config)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 326, in enable_sandbox
__import__('%s.threading' % dist27.__name__)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/threading.py", line 11, in <module>
import warnings
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 1076, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named warnings
ERROR 2017-08-31 14:09:39,070 instance.py:280] Cannot connect to the instance on localhost:52366
解决方法:
我已经通过删除我的.yaml a – venv行的skip_files解决了这个问题. venv是我的virtualenv文件夹,我还有一个 – ^ venv $行.如果有帮助的人;-)