开发者

Django admin with FCGI + lighttpd

I'm running a django installation on lighttpd +FCGI开发者_StackOverflow. Everything works fine except the admin.

It seems that the redirects after I post something (i.e. I modify sor create an instance of a model) go wrong.

The admin keeps redirecting me to www.xyz.com/django.fcgi/admin/... while django.fcgi should be used only by the lighttp rewrite rule to invoke FCGI.

Here's the redirection in the conf file

url.rewrite-once = (
                "^(/media.*)$" => "$1",
                "^/favicon\.ico$" => "/media/favicon.ico",
                    "^(/.*)$" => "/django.fcgi$1",
)

how can I fix this?


The admin site is trying to work out the URL to use based on the SCRIPT_NAME variable passed by lighttpd, but that's the rewritten URL, not the original one. You can force Django to use the original path by adding the following to your settings.py file.

FORCE_SCRIPT_NAME = ""

See the FORCE_SCRIPT_NAME documentation and the Django FastCGI docs for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜