2010-11-27 25 views
0

我不得不在某些時候看起來像,一個網址的文件:Django的:當試圖domain.com/admin給404一個老unexisting網址文件

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
# Example: 
url(r'^$', 'girls.views.home', name = 'home'), 
url(r'^registerasboy$', 'girls.views.regb', name= 'regb'), 
#url(r'^registerasgirl$', 'girls.views.reg', name= 'regg'), 
url(r'^thankyou$', 'girls.views.thankyou', name= 'thankyou'), 
url(r'^newchick$', 'girls.views.newchick', name= 'newchick'), 
url(r'^chicks$', 'girls.views.chicks', name= 'chicks'), 
#url(r'^thankyou$', 'generalsettings.views.thankyou', name = 'thankyou'), 
# Uncomment the admin/doc line below to enable admin documentation: 
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), 
#url(r'^reg$', 'generalsettings.views.home'), 
# Uncomment the next line to enable the admin: 
#(r'^admin/', include(admin.site.urls)), 
#(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':  settings.MEDIA_ROOT}), 
) 

和站點工作。我沒有管理員。所以我決定取消對管理行,我會得到錯誤404

找不到網頁(404)
請求方法:GET
請求URL:http://chicklister.com/admin

Using the URLconf defined in chick.urls, Django tried these URL patterns, 
in this order: 
^$ [name='home'] 
^registerasboy$ [name='regb'] 
^thankyou$ [name='thankyou'] 
^newchick$ [name='newchick'] 
^chicks$ [name='chicks'] 
^/(?P<path>.*)$ 
The current URL, admin, didn't match any of these. 

這是奇怪,因爲管理線在這裏丟失。現在,我還我的網址,以更新:

urlpatterns的=模式( '',
(R '^管理員/',包括(admin.site.urls)),)

和但我得到管理員:

Using the URLconf defined in chick.urls, Django tried these URL patterns, 
in this order: 
^$ [name='home'] 
^registerasboy$ [name='regb'] 
^thankyou$ [name='thankyou'] 
^newchick$ [name='newchick'] 
^chicks$ [name='chicks'] 
^/(?P<path>.*)$ 
The current URL, admin, didn't match any of these. 

然而,任何其他網址根據印刷的URL文件

小時線www.domain.com/thankyou等工作ow這可能嗎?它似乎已經在某個地方被記住了。

我做過的步驟: 在www的'registerasboy'搜索整個文件夾,並且什麼也沒有返回。 我改變了模板上的文字,以確保我正在更新正確的副本。 我在settings.py以下設置:

ROOT_URLCONF =「網址」 我發現真的沒有做任何事情,因爲在開始的時候是chic.urls

什麼我做錯了嗎?我似乎並不甚至用了這樣的內容文件...

回答

2

只是在黑暗中拍攝:

你在你的INSTALLED_APPS添加管理員,做一個執行syncdb並重新啓動服務器?

如果在mod_wsgi中使用Apache,重啓服務器很有用。它不檢測代碼中的更改,因此您需要手動重新加載它。

開發服務器自動重新加載代碼。

下面是對這個問題的完整信息: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

+0

它在我安裝的應用程序,是的。 – mgPePe 2010-11-27 15:52:36