初めまして。hirataraと申します。
TurboGears のアプリを Apache の mod_fastcgi で動かす際に、 http://myhost.com/thisismyapp
以下に設置したいのですが、TurboGears 側にも /thisismyapp/ と言うリクエストで来てしまうため、404 Not
Found となって困っています。回避策は見つけたのですが、他にもっと自然な方法があればご教授下さい。
【バージョン】
Python 2.5
TurboGears 1.0.3.4
CherryPy 2.3.0
【FastCGIとして動かす設定】
(1) httpd.conf
FastCgiServer /path/to/thisismyapp.fcgi
ScriptAlias /thisismyapp /path/to/thisismyapp.fcgi
(2) thisismyapp.fcgi
import pkg_resourcespkg_resources.require("TurboGears")
from turbogears import config, update_config, start_server
import cherrypy
cherrypy.lowercase_api = True
from os.path import *
import sys
update_config(configfile="prod.cfg",modulename="thisismyapp.config")
config.update(dict(package="thisismyapp"))
from thisismyapp.controllers import Root
# start_server(Root())
root = Root()
root.thisismyapp = root
cherrypy.tree.mount(root)
cherrypy.server.start(initOnly=True,serverClass=None)
from cherrypy._cpwsgi import wsgiApp
from flup.server.fcgi import WSGIServer
WSGIServer(wsgiApp).run()
【見つけた回避策】
RootController の thisismyapp フィールドに、 RootControllerを入れることで、
/thisismyapp/ と言うリクエストを受けれるようになる。
root.thisismyapp = root
【試してみて駄目だったこと】
(1) cherrypy.tree.mount() に引数を渡す
cherrypy.tree.mount(Root(), "/thisismyapp/")
(2) prod.cfg に、以下の記述
[/]
baseurl_filter.on = True
baseurl_filter.use_x_forward_host = False
baseurl_filter.base = "http://myhost.com/thisismyapp"
以上、よろしくお願い致します。
--~--~---------~--~----~------------~-------~--~----~
このメッセージは、次の Google グループへの参加を申し込まれたことを確認す
るために送信されました。 Google グループ "turbogears-ja" グループ。
このグループに投稿するには、次の宛先にメールを送信してください。 [email protected]
このグループから退会するには、次へメールをお送りください。
[メールアドレス保護]
その他のオプションについては、次の URL からグループにアクセスしてくださ
い。 http://groups.google.co.jp/group/turbogears-ja?hl=ja
-~----------~----~----~----~------~----~------~--~---