2

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
Karl Stulik
  • 961
  • 1
  • 12
  • 24
  • There are quite a few issues like this, usually the problem is that Flask or one of its dependencies has added some code that the App Engine sandbox will not permit. Unless you need a feature in a later version of Flask you may be better off sticking with the versions that you have found to work. See also https://stackoverflow.com/a/25915535/5320906, https://stackoverflow.com/a/47738001/5320906 and possibly https://stackoverflow.com/a/41531133/5320906. – snakecharmerb Dec 13 '17 at 08:36

1 Answers1

0

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.

dsesto
  • 7,864
  • 2
  • 33
  • 50