Problems with deploying flask WSGI application on apache2
Question: I created a one file Flask app so I can test how to deploy it on apache2
server. I followed the steps on the
[Flask](http://flask.pocoo.org/docs/deploying/mod_wsgi/#installing-mod-wsgi)
as far as the server and WSGI configuration goes. When I point to the resource
in the browser it says I have no permissions. WSGI daemon is given the same
permissions as the Flask app. Below is the VirtualHost configuration.

    
    
    <VirtualHost *:80>
    
    ServerName localhost 
    
    WSGIDaemonProcess flask_test user=someuser group=someuser threads=5
    WSGIScriptAlias /flask_test/ /var/www/flask_test/flask_test.wsgi
    
    DocumentRoot /var/www/flask_test/
    ErrorLog /var/www/flask_test/logs/error.log
    
        <Directory /var/www/flask_test/>
            WSGIProcessGroup flask_test
            WSGIApplicationGroup %{GLOBAL}
            WSGIScriptReloading On
            Order deny,allow
            Deny from all
        </Directory>
    
    </VirtualHost>
    

Here's the WSGI file

    
    
    import sys
    
    activate_this = '/home/someuser/pyProjects/general/venv/bin/activate_this.py'
    execfile(activate_this, dict(__file__=activate_this))
    
    sys.path.append('/home/someuser/pyProjects')
    
    from general import test as application
    

And finally the output from error.log

    
    
    [Tue Jul 31 01:51:18 2012] [error] Exception KeyError: KeyError(140345719740224,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
    [Tue Jul 31 01:51:21 2012] [error] [client 108.207.222.48] client denied by server configuration: /var/www/flask_test/flask_test.wsgi
    [Tue Jul 31 01:51:21 2012] [error] [client 108.207.222.48] client denied by server configuration: /var/www/flask_test/favicon.ico
    

EDIT: After implementing Graham Dumpleton suggestions server now returns code
500 with following error `TypeError: 'module' object is not callable `


Answer: Generally want:

    
    
    WSGIScriptAlias /flask_test/ /var/www/flask_test/flask_test.wsgi
    

No trailing slash on the mount point for a sub URL.

Worse is that you have:

    
    
    Deny from all
    

So you are explicitly telling Apache to return forbidden.

You should have:

    
    
    Allow from all
    

in that context.

