On May 1, 2011, at 8:01 AM, doniyor wrote: > Hi there, > i am trying to overwrite handler404 of django so that i can call my > own view function when it doesnot find the appropriate view and if it > tries to give Http404. the whole problem is as follows: > > i defined my view function called 'remap_test' in my proxy app. and i > changed the default handler404 to handler404 = > 'proxy.views.remap_test'. > The problem is that it gives all the time 404 error even if the > handler404 is defined right and even if it is in right place(in > urls.py) and the settings.py has the DEBUG = FALSE and my new view > function is theoretically ready to be called. but it isnot called, > sometimes it is. it is sooo weird. > > i will post here the code blocks i added: > > in my urls.py is this: > ....
You problem statement is a little confusing, so I'm not sure I am on the right track here Just a quick thought, Does your urls.py contain from django.conf.urls.defaults import * If you are missing the "import *" the handler404 function that your are assigning to > handler404 = 'proxy.views.remap_test' > ..... will just be a local variable and not django.conf.urls.defaults.handler404 Jason > .... > > and my view function is this: > > def remap_test(request): > return HttpResponse("test message as 404") > > and my model is this: > > class Remap(models.Model): > new_url = models.CharField(max_length=50) > src_url = models.CharField(max_length=150) > def __unicode__(self): > return self.src_url > > ... i dont know why it calls 404 all the time, sometimes i get the > problem if i add items to my database tables in admin, and sometimes > not. can someone please help me with this or does anyone have an idea > what the problem could be ? > > thank you guys so much in advance, > > doni > > -- > 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+unsubscr...@googlegroups.com. > 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 django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.