CGI 環境で bottle.py を使用して、単純なインデックス以上のものを取得/正しく返すのに苦労しています。/hello を返そうとすると、404 応答が返されます。ただし、 /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())
そして、これが私の.htaccessファイルです
DirectoryIndex index.py
<ifmodule mod_rewrite.c="">
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.py/$1 [L]
</ifmodule>
私は DH を使用しているため、ここからコードの多くをコピーしましたが、関連しているように見えました: http://blog.coderonfire.com/2010/02/running-bottle-python-micro-framework.html
助けてくれてありがとう。