2011-07-04 51 views
1

我在我的部署Django項目的萊蒂服務器的過程很。當我試圖訪問該網站的根,一切都很好,但如果我添加/管理/或/博客/我得到:的Django上的lighttpd:重定向到.fcgi(404)

Page not found (404) 
Request Method:  GET 
Request URL: http://x.x.x.x/mysite.fcgi/mysite.fcgi/admin/ 

,並

Page not found (404) 
Request Method:  GET 
Request URL: http://x.x.x.x/mysite.fcgi/mysite.fcgi/blog/ 

我讀過這個幾個職位,它似乎通過增加來解決: FORCE_SCRIPT_NAME =「」 到settings.py中。但是,這並不適合我。

urls.py:

urlpatterns = patterns('', 
(r'^$', index), 
(r'^blog/$', blog_view), 
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 
url(r'^admin/', include(admin.site.urls)), 
) 

lighttpd.conf:

$HTTP["host"] == "x.x.x.x" { 
server.document-root = "/home/lighttpd/sedin/web" 
fastcgi.server = (
    "/mysite.fcgi" => (
     "main" => (
      # Use host/port instead of socket for TCP fastcgi 
      #"host" => "127.0.0.1", 
      #"port" => 3033,    
      "socket" => "/home/lighttpd/sedin/sedin.sock", 
      "check-local" => "disable", 
      #"fix-root-scriptname" => "enable", #also tried this, but didn't work 
     ) 
    ), 
) 
alias.url = (
    "/static/admin/" => "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/", 
    "/media/" => "/home/lighttpd/sedin/media/", 
    "/static/" => "/home/lighttpd/sedin/web/static/", 
) 

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

回答

1

我殺死所有正在運行的FastCGI進程,並開始一個新的解決了這個問題。我沒有意識到,每次我對項目.py-files進行更改時,都必須重新啓動fcgi。