python.htaccessweb.py

.htaccess & web.py, preserving access to static folder after SetHandler fcgid-script


I have the following .htaccess in root in order to launch a web.py app:

allow from all
SetHandler fcgid-script
Options +ExecCGI
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.py/$1 [PT]

Everything works fine except the fact I can't access the static folder with css etc.

This is the code in the app.py:

import web
from getImgUrl import search

render = web.template.render('templates/')

urls = (
  '/', 'index'
)

class index:
    def GET(self):
        term = search()
        return render.index(term[0], term[1])

web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if __name__ == "__main__": 
    app = web.application(urls, globals())
    app.run()  

Solution

  • I solved by adding an .htaccess file in the static folder:

    SetHandler None