简体   繁体   English

ImportError:在Google App Engine上没有名为flask的模块

[英]ImportError: No module named flask on google app engine

I'm following this tutorial and I'm trying to develop a basic Flask app to run on the Google App Engine. 我正在按照本教程进行操作,并且正在尝试开发一个基本的Flask应用程序以在Google App Engine上运行。 I am using Windows and have followed the guide exactly at every step. 我正在使用Windows,并且在每个步骤中都严格按照指南进行操作。

  1. I have set up my Virtual Environment and tested if flask was in it using the import sys in the virtual environment interpreter and it is there. 我已经设置了虚拟环境,并使用虚拟环境解释器中的import sys测试了flask是否在其中。 simpleJson, Werkzeug, and Jinja2 are also there. simpleJson,Werkzeug和Jinja2也在那里。 I installed them using pip install in the virtual environment. 我在虚拟环境中使用pip install安装了它们。

  2. After checking the logs I only get a <type 'exceptions.ImportError'> saying: 检查日志后,我只得到<type 'exceptions.ImportError'>说:

 <type 'exceptions.ImportError'>: No module named flask args = ('No module named flask',) message = 'No module named flask' 
  1. This is my folder structure: 这是我的文件夹结构:
 gae/ /app/ __init__.py models.py settings.py views.py /venv/ /Include /Lib /Scripts /flask/ /simplejson/ /werkzeug/ /jinja2/ app.yaml main.py 

I have read different questions here and googled similar issues, but after trying several possible solutions, I am still not able to fix it. 我在这里阅读了不同的问题,并用谷歌搜索了类似的问题,但是在尝试了几种可能的解决方案之后,我仍然无法修复它。 At this point I don't know what I am missing, I am new to flask and GAE. 在这一点上,我不知道自己缺少什么,我对Flask和GAE是陌生的。 Any suggestion on what I am doing wrong? 关于我在做什么错的任何建议? Thanks in advance. 提前致谢。

This is my init .py: 这是我的init .py:

from flask import Flask
import settings

app = Flask('app')
app.config.from_object('app.settings')

import views

This is my app.yaml: 这是我的app.yaml:

application: app
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: main.py

This is how my requirements.txt looks: 这是我的requirements.txt的外观:

Flask==0.9  
Jinja2==2.6 
Werkzeug==0.8.3 
simplejson==3.0.7

This is my main.py: 这是我的main.py:

from google.appengine.ext.webapp.util
import run_wsgi_app from app import app

run_wsgi_app(app)

看我对类似问题的回答,逐步说明如何在Windows上运行Python,Flask,Virtualenv和Google App Engine,并验证您是否以相同的方式进行操作: 使用Google App Engine时无法导入Flask

visit link given below; 访问下面给出的链接; its a boilerplate project template for running a Flask-based application on Google App Engine (Python) 其样板项目模板,用于在Google App Engine(Python)上运行基于Flask的应用程序
https://github.com/kamalgill/flask-appengine-template https://github.com/kamalgill/flask-appengine-template

尝试在根gae目录中粘贴空白的init .py文件,然后进行导入:

from gae.flask import Flask

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM