How to solve import errors while trying to deploy Flask using WSGI on Apache2

后端 未结 2 1167
小蘑菇
小蘑菇 2020-12-13 18:09

I am having an issue deploying a flask app on apache2 using wsgi. I have posted the error logs and config files below. I have tried moving things around, renaming them, etc,

2条回答
  •  执念已碎
    2020-12-13 19:02

    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 sys
    flaskfirst = "/sites/flaskfirst"
    if not flaskfirst in sys.path:
        sys.path.insert(0, flaskfirst)
    
    from app import app
    application = app
    

    That way it's only included once

提交回复
热议问题