Setting up pico behind apache using mod_wsgi
Question: I'm trying to use [pico](https://github.com/fergalwalsh/pico) for a small
project. It works fine using the standard server shipped with pico but I'm
unable to get it running on apache.

I've already gone through
[this](http://modwsgi.readthedocs.org/en/latest/configuration-guides/running-
a-basic-application.html) guide and everything went smoothly so I know that
mod_wsgi is configured correctly.

I followed the WSGI set up instructions on the pico wiki to the letter but
this is the error I get when trying to access my page:

GET localhost/pico/client.js 404 (NOT FOUND)

Which results in the "pico is not defined" reference error.

All my test code is located in /var/www/ (I've tried other locations as well)

pico was installed using pip and is located in /usr/local/lib/python2.7/dist-
packages/pico (I even tried modifying the access permission of the files in
pico).

pico.wsgi is located in /var/www/pico/pico.wsgi

My pico.wsgi:

    
    
    import pico.server
    import sys
    sys.stdout = sys.stderr # sys.stdout access restricted by mod_wsgi
    path = '/var/www/' # the modules you want to be usable by Pico
    if path not in sys.path:
        sys.path.insert(0, path)
    
    # Set the WSGI application handler
    application = pico.server.wsgi_app
    

I might not be using my "path" variable as intended but I don't see what else
it should reference.

My httpd.conf:

    
    
    WSGIScriptAlias /pico /var/www/pico/pico.wsgi
    
        <Directory /var/www/>
        Order allow,deny
        Allow from all
        </Directory>
    

My index.html (located in /var/www/):

    
    
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="style.css">
        <script src="http://d3js.org/d3.v3.js"></script>
        <script src="/pico/client.js"></script>
        <script src="picoTest.js"></script>
    </head>
    <body>
        <div id="container">
            <div id="toolbar"></div>
            <div id="graph"></div>
        </div>
    </body>
    </html>
    

And finally, sys.path printed from pico.wsgi:

    
    
    ['/var/www/', '/var/www/pico', '/usr/local/lib/python2.7/dist-packages/pip-1.3.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/virtualenv-1.9.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/distribute-0.6.35-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/gevent_websocket-0.3.6-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/daemon-1.0-py2.7.egg', '/home/kjartan/work/risk/maynard', '/var/www/pico', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
    

I'm new to apache and wsgi in general so there might be something obvious I'm
missing.


Answer: I think the WSGIScriptAlias line should be

    
    
    WSGIScriptAlias /pico /var/www/pico/pico.wsgi/pico
    

Note the `/pico` after the `.wsgi`

This became necessary after an update to pico a while ago but I forgot to
update the [wiki](https://github.com/fergalwalsh/pico/wiki/WSGI). Apologies
for that.

