I am trying to deploy a simple flask app on an VPS running Ubuntu 20 and LAMP
The app runs fine when I execute it with flask run
from inside the app folder
However the server log has errors:
[Sun Oct 24 14:55:03.464311 2021] [wsgi:error] [pid 5655] [client 90.198.214.109:59097] from FlaskApp import app as application
[Sun Oct 24 14:55:03.464323 2021] [wsgi:error] [pid 5655] [client 90.198.214.109:59097] File "/var/www/FlaskApp/FlaskApp/__init__.py", line 1, in <module>
[Sun Oct 24 14:55:03.464363 2021] [wsgi:error] [pid 5655] [client 90.198.214.109:59097] from flask import Flask
[Sun Oct 24 14:55:03.464386 2021] [wsgi:error] [pid 5655] [client 90.198.214.109:59097] ImportError: No module named flask
The code and instructions are taken from here: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps
When going to the server's IP, an error message shows up:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
EDIT:
When I run the code using command sudo python __init__.py
it gives the error that cannot import flask from Flask
while using the command sudo python3 __init__.py
works just fine. It seems like the whichever script invokes the wsgi file is calling using the python
style of calling which triggers the error of being unable to start the script