Flask with mod_wsgi - Cannot call my modules
<p>I have changed my application running with flask and python2.7 from a standalone solution to flask with apache and mod_wsgi.</p>
<p>My Flask app (app.py) includes some classes which are in the directory below my app dir (../).</p>
<p>Here is my app.wsgi:</p>
<pre>

    #!/usr/bin/python
    import sys
    import logging
    logging.basicConfig(stream=sys.stderr)
    sys.stdout = sys.stderr
    
    
    project_home = '/opt/appdir/Application/myapp'
    project_web  = '/opt/appdir/Application/myapp/web'
    
    
    if project_home not in sys.path:
        sys.path = [project_home] + sys.path
    
    if project_web not in sys.path:
        sys.path = [project_web] + sys.path
    
    from app import app
    application = app
    </pre>
<p>Before my configuration to mod_wsgi my main call in the app.py looks like that:</p>
<pre>

    # Main
    if __name__ == '__main__' :
        from os import sys, path
        sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
        from logger import Logger
        from main import Main
        from configReader import ConfigReader
        print "Calling flask"
        from threadhandler import ThreadHandler
        ca = ConfigReader()
        app.run(host="0.0.0.0", threaded=True)

</pre>
<p>I was perfectly able to load my classes in the directory below.
After running the app with mod_wsgi I get the following error:
global name \'Main\' is not defined</p>
<p>So how do I have to change my app that this here would work:</p>
<pre>

    @app.route("/")
    def test():
       main = Main("test")
       return main.responseMessage()
 </pre>