How to solve import errors while trying to deploy Flask using WSGI on Apache2
Thanks to zarf
and damjan
on irc.freenode.org at #pocoo, they were able to help me get this fixed. The problem was the PythonPath was not correct. We fixed this by using the following wsgi.py
import syssys.path.insert(0, "/sites/flaskfirst")from app import appapplication = app
I used your solution to get it working but it kept duplicating the path in sys.path (you can write it out to see if it happens to you) so I made a little modification:
import sysflaskfirst = "/sites/flaskfirst"if not flaskfirst in sys.path: sys.path.insert(0, flaskfirst)from app import appapplication = app
That way it's only included once