Hi all
Trying out PythonAnywhere for first time. Very frustrating experience so far. I have followed all tutorials I could find to the letter but I can't seem to get my tiny Flask API to work. I keep running into ModuleNotFoundError when trying to run the app:
2019-12-19 13:05:11,476: Error running WSGI application
2019-12-19 13:05:11,478: ModuleNotFoundError: No module named 'flask_cors'
2019-12-19 13:05:11,479: File "/var/www/kayjay_eu_pythonanywhere_com_wsgi.py", line 16, in <module>
2019-12-19 13:05:11,479: from flask_app import app as application # noqa
2019-12-19 13:05:11,479:
2019-12-19 13:05:11,479: File "/home/kayjay/backend/flask_app.py", line 2, in <module>
2019-12-19 13:05:11,480: from flask_cors import CORS
2019-12-19 13:05:11,480: ***************************************************
2019-12-19 13:05:11,480: If you're seeing an import error and don't know why,
2019-12-19 13:05:11,480: we have a dedicated help page to help you debug:
2019-12-19 13:05:11,480: https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-12-19 13:05:11,481: ***************************************************
I first create a new web app and then I upload 3 files:
- flask_app.py containing my app
- helpers.py with my helper function
- requirements.txt with all my packages needed
I double checked and it is overwriting the flask_main.app created originally. I then go to the bash terminal and perform some actions as instructed here: https://help.pythonanywhere.com/pages/Flask/
I create the virtualenv and do a pip install -r requirements.txt
.
Then I "reload" the app and I just get the errors mentioned earlier. When I activate my virtualenv in bash and do a pip freeze I see all my packages as intended, even the flask_cors one that it supposedly can't import.
I can even import them myself when I run python within my virtualenv.
Some help is much appreciated.