When running flask app on google app engine , it throws me an error that I have to serve my app on port 8080. So I specified the port in
if __name__ == "__main__":
app.run(port=8080)
But on running it on App engine it shows that my app is still serving on https://127.0.0.1:5000
EDIT : I got confused somewhere on running the app, so I tried running the app locally using dev_appserver.py app.yaml
( this throws an error)
On running dev_appserver.py ./
runs the server , but I the page at localhost:8080
is blank , And I get an error in the terminal that it was unable to import python modules even though I have made a appengine_config.py
script and a lib subfolder with all the python packages downloaded to it.
My project structure is :
root/
-app.py
--lib/
--static/
--templates/
-app.yaml
-appengine_config.py
EDIT : The server seems to be running fine now , but it is still unable to import python packages ( I have them installed in the lib folder , also I have used the sys hack ) Here's the error:
Traceback (most recent call last):
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/padam/Documents/git/gae-fumen/app.py", line 4
from flask import Flask, render_template, jsonify, request
^
How do I fix it ?
if __name__ == "__main__": app.run(port=8080)
I also tried without using the above code , it still served on 5000 – Padam Sethiaapp.yaml
? how are you starting the app? – Jeffrey Godwyll