0

I am trying to run a flask application using local dev server of appengine. My yaml file is:

runtime: python37
entrypoint: uwsgi --wsgi-file src/main.py --callable app --master --processes 1 --threads 2

and my main.py is:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def main():
    return 'Hello'
if __name__ == '__main__':
    app.run(debug=True)

I am trying to run the dev server using python2:

dev_appserver.py /path_to/app.yaml --admin_port=9030 --port=9530

I guess it runs fine and I get these logs in the terminal:

INFO     2020-02-09 14:14:27,298 dispatcher.py:256] Starting module "default" running at: http://localhost:9530
INFO     2020-02-09 14:14:27,306 admin_server.py:150] Starting admin server at: http://localhost:9030
INFO     2020-02-09 14:14:28,301 instance.py:561] Cannot decide GOOGLE_CLOUD_PROJECT, using "test" as a fake value
/bin/sh: line 0: exec: uwsgi: not found
ERROR    2020-02-09 14:14:29,318 instance.py:284] Cannot connect to the instance on localhost:18241

I can access the admin server but when I call my hello world url it does not show and it keeps repeating the msg: Cannot decide GOOGLE_CLOUD_PROJECT...

Rodwan Bakkar
  • 474
  • 3
  • 17
  • The dev server with python 3 may not be working properly, see https://stackoverflow.com/a/53000831/4495081. But maybe things have changed since. Try setting the GOOGLE_CLOUD_PROJECT env var before launching the server. – Dan Cornilescu Feb 09 '20 at 14:45
  • Thank you! GOOGLE_CLOUD_PROJECT is it a yaml config? – Rodwan Bakkar Feb 09 '20 at 14:47
  • when I use python3 to run the dev_server I get an error `assert sys.version_info[0] == 2` and that's why I tried python2 – Rodwan Bakkar Feb 09 '20 at 14:50
  • There used to be an `application: ` config for the 1st gen GAE apps, now no longer documented but apparently still working - I still have it in mine. Donno if working for the 2nd gen apps. – Dan Cornilescu Feb 09 '20 at 14:50
  • is it the id of the google cloud project? if so, why to set this parameter if still just trying to run it on the local server? – Rodwan Bakkar Feb 09 '20 at 14:52
  • The project name for that config, unsure about the env var. Try both name and id :) As for why - things moved towards passing such info (more than just the project) through env vars, the implementation may have changed accordingly. Donno if that alone is the root of your problem or just a side effect. – Dan Cornilescu Feb 09 '20 at 14:57
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/207498/discussion-between-dan-cornilescu-and-rodwan-bakkar). – Dan Cornilescu Feb 09 '20 at 15:02

0 Answers0