When I try to follow the example from <Python Web Development with Django>, to set up the Automatic admin Application, I face this problem “No module named urls “:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Exception Type: TemplateSyntaxError
Exception Value:
Caught an exception while rendering: No module named urls

The answer is really simply because Django’s Backwards-incompatible changes:

Merged newforms-admin into trunk

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

After solving this issue, I found a mark on the book’s cover page showed “Covers Django 1.0″, which means, in some part of this book, sample codes maybe written in previous Django pattern, so be caution to face this same kind of problem again. Good Luck~

Tags: ,,.
首页

No Comments Now!

Be the first to comment on this entry.

发表评论

名称(必填)
Mail (必填),(will not be published)
网址(recommended)

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://www.xiangee.cn),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.