Monday, November 28, 2011

Re: django.conf.urls import question



On Fri, Nov 25, 2011 at 6:39 PM, Chet <ccorcos@gmail.com> wrote:
Hello,

I just finished to tutorial and for in both my urls.py files, if I
use:

from django.conf.urls import patterns, include, url

I get an http500 error: TemplateDoesNotExist: 500.html

This message is from Django, trying to tell you that there is a configuration error, but it can't display that error to you because it is missing the template for the "500" server error page. (Do you have DEBUG disabled in your settings? Set it to True, and Django should use its built-in technical error page, which will show you all of the details of the underlying error.)
 
The error itself is very likely an import error, because that line in your urls.py shouldn't work. Specifically, 'patterns', 'include', and 'url' aren't defined directly inside of the django.conf.urls module, but as part of django.conf.urls.defaults. (at least, until Django 1.4)

before I had it as:

from django.conf.urls.defaults import patterns, include, url

This line is correct for all released versions of Django.

and when I change this statement to be default, everything works fine.
I don't know why. In the tutorial it says to do it the first way


What Django version are you using to run through the tutorial?

It sounds to me like you are have a released version of Django (1.2, 1.3, etc) installed, but you are following the tutorial for the development version. (There used to be a big warning about this at the top of all every page in the development docs, but it seems to have disappeared.)

Try following the tutorial starting at
instead, and see how far you can get.


--
Regards,
Ian Clelland
<clelland@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment