In your example, when testing the 404 page, you wrote that you're no
longer visiting a url under http://localhost:8000, but now you're
visiting a url under http://fairware:8000 – was this an error in your
post or were you actually checking the wrong server?

The testserver will handle 404 pages properly if you have
DEBUG=False.  What I would do to test this is:

1. Set DEBUG=True
2. Run the test server and go to a page that shows the debug mode 404
page not found
3. Change to DEBUG=False
4. Reload the page (the test server doesn't require restart)
5. If you have a template in the root of one of your template dirs
named 404.html — then it should work

If it still doesn't work after that, maybe check to see if you have
any non-standard settings in your settings file like, maybe you
removed this option from your TEMPLATE_LOADERS:
'django.template.loaders.filesystem.load_template_source', or maybe
you setup something weird for "handler404" in your urls.py file.

Good luck!

Peter

On Sep 6, 3:33 pm, moreeon <morgan.dal...@gmail.com> wrote:
> Hi everyone, I'm struggling with an issue my girlfriend says is
> "ironic". I can't get my custom 404 page to show.  I've broken this
> down to the simplest possible case. Here's what I did:
>
> Create a new project called "experiment" in /home/me/experiment and
> add a directory to that called templates. Here's the contents of /home/
> me/experiment/experiment:
>
> __init__.py
> manage.py
> settings.py
> templates
> urls.py
>
> modify the following in settings.py:
> DEBUG = False
> TEMPLATE_DIRS = (
>     # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
>     # Always use forward slashes, even on Windows.
>     # Don't forget to use absolute paths, not relative paths.
>     "/home/me/experiment/experiment/templates"
> )
>
> start up the testserver and go to
>
> http://localhost:8000/osdijfosdijf
>
> and get
>
> "TemplateDoesNotExist: 500.html".
>
> OK, makes sense. Now add 500.html to the ..../experiment/templates
> directory. Contents are "500 page".
>
> revisit:
>
> http://localhost:8000/osdijfosdijf
>
> again and  see
>
> "500 page"
>
> Perfect. Now the weird part. Add a "404.html" to the same templates
> directory and put this in it:
>
> "404 page"
>
> and again go to
>
> http://fairware:8000/sdfdf
>
> now firefox says:
>
> "Cannot Complete Request
>
> Additional information about this problem or error is currently
> unavailable"
>
> here's what gets spat out of the testserver when I submit the request:
>
> [06/Sep/2009 17:55:20] "GET /sdfdf HTTP/1.1" 404 9
>
> I feel like there isn't much to be missed here, but that I must have
> missed it. If I create a file called "404.html" in my root template
> directory, shouldn't I see the contents of that file when I get a 404?
> Obviously django is finding the template.
>
> I'm using django 1.1 with python 2.6 on ubuntu jaunty. I've (mis?)read
> all of the django docs I can find on this. If anyone has incite,
> please share.
>
> Thank You
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to