Problems with Routing URLs using CGI and Bottle.py

Posted by Risingson on Stack Overflow See other posts from Stack Overflow or by Risingson
Published on 2010-04-18T22:57:21Z Indexed on 2010/04/18 23:03 UTC
Read the original article Hit count: 485

Filed under:
|
|
|

I've been having difficulty getting anything more than a simple index / to return correctly using bottle.py in a CGI environment. When I try to return /hello I get a 404 response. However, if I request /index.py/hello

import bottle
from bottle import route

@route('/')
def index():
    return 'Index'

@route('/hello')
def hello():
    return 'Hello'

if __name__ == '__main__':
    from wsgiref.handlers import CGIHandler
    CGIHandler().run(bottle.default_app())

And here is my .htaccess file

DirectoryIndex index.py
<ifmodule mod_rewrite.c="">
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.py/$1  [L]
</ifmodule>

I copied much of the code from here as I'm using DH and it seemed relevant: http://blog.coderonfire.com/2010/02/running-bottle-python-micro-framework.html

Thanks for helping.

© Stack Overflow or respective owner

Related posts about python

Related posts about bottle