我正在尝试跑步dev_appserver.py
在此Google App Engine 标准 Flask 示例 https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard/flask/tutorial
正如说明所说,我运行:
pip install -t lib -r requirements.txt
dev_appserver.py app.yaml
我应该可以去http://localhost:8080/form
但我得到ImportError: No module named msvcrt
.
我发现使用Flask==0.10.1
and Werkzeug==0.12.2
有效,但没有更新。
版本:
OS: Windows 10 Pro
Python 2.7.14
Google Cloud SDK 182.0.0
app-engine-go
app-engine-python 1.9.63
app-engine-python-extras 1.9.63
bq 2.0.27
core 2017.12.01
gsutil 4.28
我自己从 Cloud Shell 尝试了该示例,并且还发现了一些导入问题。看起来 Werkzeug 的新版本已将代码转移到不同的位置,因此如建议的那样在最近的这篇文章中 https://stackoverflow.com/questions/47716196/gae-standard-flask-tutorial-importerror-cannot-import-name-spooledtemporaryfil如果您想按原样使用示例,您最好使用 Werkzeug 0.12.2 版本。
为此,我建议您执行以下步骤:
- 删除
lib
应用程序目录中的文件及其所有内容。
- 编辑
requirements.txt
文件如下:
要求.txt:
Flask==0.12.2
werkzeug==0.12.2
- 再次运行命令
pip install -t lib -r requirements.txt
.
现在您可以尝试使用以下命令在本地运行您的应用程序dev_appserver
。请确保appengine_config.py
文件指向正确的位置lib
正在安装库的文件夹。
完成所有这些后,一切都应该正常工作。我尝试浏览您提到的本地主机 URL,并出现一个带有表单的简单 HTML 页面。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)