开发者

Django: when trying domain.com/admin gives 404 with an old unexisting urls file

I had at some point an urls file that looked like that:

# 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}),
)

And the site worked. I didn't have an admin. So i decided to uncomment the admin line, and i would get error 404

Page not found (404)

Request Method: GET

Request 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.

which is weird, because the admin line is missing here. Now, i Updated further my urls to:

urlpatterns = patterns('',

(r'^admin/', include(admin.site.urls)),)

and yet i get for 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='chi开发者_Python百科cks']
^/(?P<path>.*)$
The current URL, admin, didn't match any of these.

and yet, any other url works such as www.domain.com/thankyou according to the lines in the printed url file

How is this possible? It seems like it has been remembered somewhere.

Steps i did: searched the whole folder in www for 'registerasboy' and returned nothing anymore. i changed the text on the template, to make sure i am updating the right copy. i have the following settings in the settings.py:

ROOT_URLCONF = 'urls' which i noticed didn't really do anything, since in the beginning it was chic.urls

What am i doing wrong? i don't seem to even a file with such content anymore...


Just a shot in the dark:

Did you add the admin in your INSTALLED_APPS, do a syncdb and restarted the server ?

Restarting the server is useful if you use Apache with mod_wsgi. It does not detect the changes in the code so you need to reload it manually.

The development server reloads code automatically.

Here is the complete information about this issue : http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜