Serve static files with openshift and python
Question: I've set up [rawdog](http://offog.org/code/rawdog/) in an OpenShift
application and installed the Python and cron cartridges. I get the
application to serve the generated HTML, however the css stylesheet is not
available.

I use the following wsgi.py file.

    
    
    #!/usr/bin/python
    import os
    
    SERVE_FILE = os.path.join(os.environ['OPENSHIFT_DATA_DIR'], 'www', 'index.html')
    
    virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
    virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
    try:
        execfile(virtualenv, dict(__file__=virtualenv))
    except IOError:
        pass
    
    def application(environ, start_response):
        status = '200 OK'
        output = open(SERVE_FILE, 'r').read()
    
        response_headers = [('Content-type', 'text/html'),
                            ('Content-Length', str(len(output)))]
        start_response(status, response_headers)
    
        return [output]
    
    if __name__ == '__main__':
        from wsgiref.simple_server import make_server
        httpd = make_server('localhost', 8051, application)
        # Wait for a single request, serve it and quit.
        httpd.handle_request()
    

The css file should be in the same 'folder' as index.html,

    
    
    <link rel="stylesheet" href="style.css" type="text/css">
    

The css file is in `~/app-root/repo/wsgi/static/css/style.css`. I also have
a`~/app-root/repo/wsgi/.htaccess` file that contains:

    
    
    RewriteEngine on
    RewriteRule   ^/style.css static/css/style.css  [R]
    

So far it doesn't seem to be working. Any ideas on how I can make static
content available on OpenShift using Apache?


Answer: Your `<link rel="stylesheet" href="style.css" type="text/css">` should
probably look like `<link rel="stylesheet" href="static/css/style.css"
type="text/css">`

