I'm trying to deploy a fairly simple Flask app with a couple views using Google's App Engine. As far as I know, nothing is wrong with the Flask code itself - it runs just fine on a local port. The problem, however, occurs when I cd into the project directory and run "gcloud app deploy." The app deploys without any errors and returns a 502 code when I go into the .appspot.com domain reserved for the app.
I was a little confused, so I ran "gcloud app logs tail." This is the message that is displayed on repeat in the logs:
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
[2019-01-06 23:55:00 +0000] [240] [INFO] Starting gunicorn 19.9.0
[2019-01-06 23:55:00 +0000] [240] [ERROR] Connection in use: ('', 8081)
[2019-01-06 23:55:00 +0000] [240] [ERROR] Retrying in 1 second.
[2019-01-07 23:55:01 +0000] [240] [ERROR] Can't connect to ('', 8081)
Running "netstat -ano" shows no processes that are actually using port 8081. Running netstat and killing whatever process was using the occupied port was suggested in a post with a problem similar to mine. However, there's literally nothing using 8081 here.
"main" is main.py, a file that creates an app, registers all the blueprints, and runs the app with
app.run(host="0.0.0.0", debug=True)
I'm totally new to using the App Engine - am I missing something? Anyone know where to start?
app.yaml
file in the original post, so here's the code, if you can make it out. I don't think I changed much from the Google App Engine tutorial: runtime: python37 entrypoint: gunicorn -b :$PORT main:app handlers: - url: /static static_dir: static - url: .* script: auto – Justas Stankevičius