The Django flatpages app has a well-known and oft-discussed-on-the-web bug related to a missing 404.html "Page Not Found" template in your project's templates directory. If you have DEBUG = False in your settings.py file, and you're missing the 404.html file, flatpages will generate a 500 server error instead of loading the flatpage because the project tries to find the 404.html template, and the 500 is generated because it isn't there.
My problem is different than this. I do have a 404.html in my templates directory, hooked into my project, the Middleware is hooked up, the SITE_ID is correct for each flatpage, and the templates/flatpages/default.html file exists.
When I try to load any flatpage, I get my custom 404.html error page returned to me. So, the 404 template is working, but the flatpage middleware doesn't seem to be checking the URLs in the flatpage models before it falls back on the 404.
Has anyone else experienced this and/or found a solution? This is a beta version, so perhaps a solution is in the works as I type. I'm using Django 1.1 beta 1.
Here is my entire MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'djangodblog.DBLogMiddleware', 'ecomstore.SSLMiddleware.SSLRedirect', 'ecomstore.marketing.urlcanon.URLCanonicalizationMiddleware', 'django.contrib.redirects.middleware.RedirectFallbackMiddleware', )