`

Django: “No module named urls” error for /admin/

阅读更多
No module named urls问题的解决方法如下:
# OLD:
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^admin/', include('django.contrib.admin.urls')),
)

# NEW:
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
)



Your url for admin should be:
(r'^admin/', include(admin.site.urls))

not
(r'^admin/(.*)', admin.site.root) 


it's for Django 1.0. For Django 1.3 it wouldn't work.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics