Google App Engine Standard dev_appserver.py giving a Import Error

杀马特。学长 韩版系。学妹 提交于 2019-12-11 03:37:37

问题


I am trying to run dev_appserver.py on this Google App Engine Standard Flask Sample

As the instructions say I run:

pip install -t lib -r requirements.txt
dev_appserver.py app.yaml

I should be able to go to http://localhost:8080/form but I get ImportError: No module named msvcrt.

I found that using Flask==0.10.1 and Werkzeug==0.12.2 works but nothing newer.

Versions:

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

回答1:


I have tried the example myself from the Cloud Shell, and I also found some issues with the imports. It looks like newer releases of Werkzeug have transferred code to different locations, so as suggested in this recent post if you want to use the example as it is, you should better work with the version 0.12.2 of Werkzeug.

To do so, I recommend you the following steps:

  1. Delete the lib file in the directory of the application, and all of its content.
  2. Edit the requirements.txt file to be as follows:

requirements.txt:

Flask==0.12.2
werkzeug==0.12.2
  1. Run again the command pip install -t lib -r requirements.txt.

Now you can try running your application locally with the dev_appserver. Please make sure that the appengine_config.py file is pointing to the proper location of the lib folder where the libraries are being installed.

Once you have done all that, everything should be working fine. I have tried browsing for the localhost URL you mentioned and a simple HTML page with a form appears.



来源:https://stackoverflow.com/questions/47788484/google-app-engine-standard-dev-appserver-py-giving-a-import-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!