All I can suggest is some pdb time.

First, from the manage.py shell, can you import your view's module, and can
you reference your view function (or class) off of the name of your import?
Run  type on it, and otherwise inspect it.  Call it from pdb.run() (you have
to put the expression that calls the view in quotes, since pdb.run() wants
a string).  I've had trouble doing this lately: you may need to define a
function at the command line that calls pdb.set_trace() and then calls the
view, then simply call the new def (that is, no pdb.run()).  You will have to
supply the correct number of arguments for the view, but they can all be
None, since the point is to see if you can single step into the first real
code of the function.  Actually, you may have to dummy something that
looks like a request if your view function is decorated, since the decorators
are highly likely to need something or other from the decorator.

The other approach is to stick a pdb.set_trace() in the code that parses
the request path through your urlconf, and, while in the development
server, make the corresponding request, either with your browser, or
with a separate python program (makes it easy to POST without having
to get the form first -- You can also use curl for this, but reading the
man page takes me longer than calling urlib2.urlopen, so I thing of
python first).  See if what it finds is your view function or not.

Also, urlconf is sometimes built early (some module calls reverse() at
top level, so the urlconf is built before reverse returns).  So you may
want to look at how it's being constructed, by finding the right place
for a set_trace() in that code.

I'd also grep the sources to see who can raise ViewDoesNotExist.
It's not a primitive error, so it must be defined and raised within
the Django sources somewhere.  That might give you a hint, or
give you a finer grained place to put a set_trace() and look at the
local variable there and on up the stack.

I tend to run things I expect to call set_trace() from an emacs
sub-shell window, since python-mode recognizes the pdb print
outs and puts up the corresponding file with a pointer on the
current line.  Perhaps your favorite IDE has a similar capability.
It makes single stepping along and knowing the context (and
thus what variables are interesting) a lot more pleasant than
just looking at the pdb output yourself.

Bill

On Sat, Mar 10, 2012 at 5:05 PM, Scott Macri <[email protected]> wrote:
> That's exactly what I was thinking.  So I changed
> 'django.contrib.auth.views.change_password' to
> 'django.contrib.auth.views.bullfrog' in the urlconf.  It renders a
> completely different error.  Something to the effect of bullfrog not
> existing.
>
> On Sat, Mar 10, 2012 at 3:12 PM, Bill Freeman <[email protected]> wrote:
>> I would expect ViewDoesNotExist to not be sensitive to the template.  It
>> sounds like the urlconf is specifying a view function that does not exist
>> (at least in the way and in the place that it is specified).
>>
>> On Sat, Mar 10, 2012 at 3:07 PM, Scott Macri <[email protected]> wrote:
>>> Even explicitly setting the template name causes a ViewDoesNotExist
>>> error to occur.
>>> url(r'^accounts/password/change/$',
>>> 'django.contrib.auth.views.password_change',{'template_name':'registration/password_change_form.html',}),
>>>
>>> Anyone have any ideas?  Thanks.
>>>
>>> On Fri, Mar 9, 2012 at 1:32 PM, Scott Macri <[email protected]> wrote:
>>>> Being new to django I am having trouble getting the built in views to
>>>> work.  After several hours I finally got the login/logout views to
>>>> work, now I am not able to get the profile, or any other built in
>>>> views working.  I am attempting to configure the change_password view.
>>>>
>>>> I have a custom urls.py file in myapp directory.  The main url points
>>>> to the one in myapp.  I don't have any trouble getting any of my own
>>>> custom views working.  However, when I try to access the change
>>>> password view I keep getting a view does not exist.  I'm not sure why
>>>> this is happening.
>>>>
>>>> Here is what I have:
>>>> main urls.py
>>>> urlpatterns = patterns('',
>>>>    url(r'^myapp/',include('myapp.urls')),
>>>> )
>>>>
>>>> In the myapp folder in urls.py I have a bunch of views like this:
>>>> urlpatterns = patterns('',
>>>>        url(r'^accounts/login/$',  'django.contrib.auth.views.login'),
>>>>        url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
>>>>        url(r'^accounts/out/in/$', 
>>>> 'django.contrib.auth.views.logout_then_login'),
>>>>        url(r'^accounts/password/change/$',
>>>> 'django.contrib.auth.views.password_change'),
>>>>        url(r'^index/?','hcp.views.index'),
>>>> )
>>>>
>>>> Attempting to access the following link works perfectly:
>>>> http://localhost:8000/myapp/accounts/login/?next=/myapp/home
>>>>
>>>> However, attempting to access any of the other built-in-views, such as:
>>>> http://localhost:8000/myapp/accounts/password/change/
>>>>
>>>> renders a ViewDoesNotExist error when logged in as the user.......
>>>>
>>>> I've followed the directions on the django site and created the
>>>> registration/password_change_form.html file in my templates directory
>>>> right next to my login.html file.
>>>>
>>>> I'm not sure what I can do, I've been struggling with getting these
>>>> views to work for most of the day again today.
>>>>
>>>> When I try to access the logout_then_login via the following link:
>>>> http://localhost:8000/myapp/accounts/out/in
>>>>
>>>> everything works perfectly.
>>>>
>>>> What could be some possible issues causing this problem?  Thanks.
>>>>
>>>> --
>>>> Scott
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Scott A. Macri
> www.ScottMacri.com
> (571) 234-1581
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to