Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I am using Windows and have followed the guide exactly at every step.

  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. simpleJson, Werkzeug, and Jinja2 are also there. I installed them using pip install in the virtual environment.

  2. After checking the logs I only get a <type 'exceptions.ImportError'> saying:

<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. Any suggestion on what I am doing wrong? Thanks in advance.

This is my init.py:

from flask import Flask
import settings

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

import views

This is my app.yaml:

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

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

This is how my requirements.txt looks:

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

This is my main.py:

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

run_wsgi_app(app)
like image 929
lv10 Avatar asked Dec 07 '25 06:12

lv10


1 Answers

Look my answer to a similar question, explaining step by step how to run Python, Flask, Virtualenv and Google App Engine on Windows and verify if you are doing on same way: Can't import Flask while using Google App Engine

like image 157
maxcnunes Avatar answered Dec 09 '25 18:12

maxcnunes