Google App Engine Standard dev_appserver.py giving

2019-07-14 06:27发布

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条回答
smile是对你的礼貌
2楼-- · 2019-07-14 07:17

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.

查看更多
登录 后发表回答