I have developed a rest API using flask to serve a Deep Learning model developed in Python3.6/tensorflow/keras. The app is using a virtual environment in which keras (and all other required modules) are installed. I specified the path to the virtual env in the app page (Web tab), as well as the working directory and the code directory.
When I just go to the API root URL, it outputs 'Test 123' as expected, however when I try to query the API, nothing happens (no reply, browser shows like the page is loading forever).
When I inspect the logs, here's what I get:
2018-02-17 17:01:44,932: Error running WSGI application
2018-02-17 17:01:44,937: ModuleNotFoundError: No module named 'keras'
2018-02-17 17:01:44,937: File "/var/www/tixierae_pythonanywhere_com_wsgi.py", line 16, in <module>
2018-02-17 17:01:44,937: from flask_app import app as application
2018-02-17 17:01:44,938:
2018-02-17 17:01:44,938: File "/home/tixierae/mysite/flask_app.py", line 5, in <module>
2018-02-17 17:01:44,938: from keras.models import load_model
However, when I run the tixierae_pythonanywhere_com_wsgi.py file, it works and opens a console as expected. From there I am able to execute keras.models import load_model without any issue.
Any help would be much appreciated. I have reloaded the app multiple times.