Google AppEngine error: “No module named flask”

2019-02-25 00:12发布

I'm following the directions provided by WebPutty's github page to put my own fork of WebPutty up on GAE. It runs fine locally. I wasn't able to run "fab deploy" successfully (got error "no module named appengine.api"), so instead tried to put it up on GAE by just doing appcfg.py update. Unfortunately, this gives me the following error when I access the URL: "No module named flask".

Would love any insight/assistance as to how to resolve.

2条回答
Melony?
2楼-- · 2019-02-25 00:46

I don't know if you already did this, but to work with GAE and python you need have the dependent packages inside your project, as Flask, Werkzeug, Jinja2 and SimpleJson.

Here there is the script I use on my project:

# set the path of your project
PATH_PROJECT=~/Development/python/projects/scheduler-i-sweated-yesterday

cd ~/Downloads

#
# Installing Flask: https://github.com/mitsuhiko/flask/tags
#
wget https://github.com/mitsuhiko/flask/archive/0.9.zip
unzip 0.9.zip
mv flask-0.9/flask $PATH_PROJECT/flask

#
# Installing Werkzeug: https://github.com/mitsuhiko/werkzeug/tags
#
wget https://github.com/mitsuhiko/werkzeug/archive/0.8.3.zip
unzip 0.8.3.zip
mv werkzeug-0.8.3/werkzeug $PATH_PROJECT/werkzeug

#
# Installing Jinja2: https://github.com/mitsuhiko/jinja2/tags
#
wget https://github.com/mitsuhiko/jinja2/archive/2.6.zip
unzip 2.6.zip
mv jinja2-2.6/jinja2 $PATH_PROJECT/jinja2

#
# Installing SimpleJson: https://github.com/simplejson/simplejson/tags
#
wget https://github.com/simplejson/simplejson/archive/v3.0.5.zip
unzip v3.0.5.zip
mv simplejson-3.0.5/simplejson $PATH_PROJECT/simplejson

Save as install_packages_dependencies.sh and after that run in the shell:

bash install_packages_dependencies.sh
查看更多
家丑人穷心不美
3楼-- · 2019-02-25 00:46

I had this exact same problem. I'm on Mac OS X Lion. I fixed the problem by moving the GoogleAppEngineLauncher.app from my desktop to the application directory. fabfile.py looks for the app there. After I moved the app to where fabfile.py was looking for it, I ran "fab deploy" and everything worked perfectly. I hope this helps.

查看更多
登录 后发表回答