0

I have a Flask app and I'm trying to expose several API's via this app. I'm using Docker to start this app and here are the logs after I started the app:

Joes-MacBook-Pro-78:my-flask-api joe$ docker run -p 5000:5000 --name my-flask-api my-flask-api
/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:819: UserWarning: SQLALCHEMY_DATABASE_URI not set. Defaulting to "sqlite:///:memory:".
  'SQLALCHEMY_DATABASE_URI not set. Defaulting to '
/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:839: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
[2018-11-29 16:54:58,812] [werkzeug] [INFO]   * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2018-11-29 16:54:58,813] [werkzeug] [INFO]   * Restarting with stat
/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:819: UserWarning: SQLALCHEMY_DATABASE_URI not set. Defaulting to "sqlite:///:memory:".
  'SQLALCHEMY_DATABASE_URI not set. Defaulting to '
/usr/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:839: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
[2018-11-29 16:54:59,069] [werkzeug] [WARNING]   * Debugger is active!
[2018-11-29 16:54:59,070] [werkzeug] [INFO]   * Debugger PIN: 123-456-789

Is there anything that I could do to see what is wrong with this? How can I debug this to see more logs that would enable me to know what is happening in the background? Any ideas?

Right now when I hit the API, I get the following error in Chrome:

This page isn’t working localhost didn’t send any data.
ERR_EMPTY_RESPONSE
joesan
  • 13,963
  • 27
  • 95
  • 232
  • What response do your API requests get? – roganjosh Nov 29 '18 at 17:06
  • They should send me a JSON back. I suspect it could be because of the database URI? It defaults to sqlite memory, but I do not prefill this database with any data. Could that be the issue? – joesan Nov 29 '18 at 17:09
  • That will be an issue, but what are you hitting the API with? `requests`? What's the function that should handle the request? – roganjosh Nov 29 '18 at 17:10
  • http://localhost:5000/api is what I'm hitting! – joesan Nov 29 '18 at 17:12
  • That doesn't answer any of what I was asking but I suppose the dupe is sufficient to explain what's going on – roganjosh Nov 29 '18 at 17:14
  • Yes, you are correct! The dupe was sufficient to explain the problem. After doing app.run(host='0.0.0.0') it worked! Thanks anyway – joesan Nov 29 '18 at 17:33

0 Answers0