I’m learning django with this excellent book “Practical Django Projects”. I was able to follow the steps of the book perfectly, but now I stumbled upon the following problem.
When creating the page http://127.0.0.1:8000/first-page/ as image below:

I found the following error page:

Slightly different of this one, announced on book (page 16):

Then, I openned the file urls.py and added to it the following line of code:
(r'', include ('django.contrib.flatpages.urls')),
And the code looks like this:

I saved urls.py and accessed http://127.0.0.1:8000/first-page/ again, finding the same error message above (nothing changed), when, according to the book, I should now have found this other error page:

As a result, after I create the directory and file default.html for templates, as follows:

And have changed the TEMPLATE_DIRS settings.py file like this:

Again, the http://127.0.0.1:8000/first-page/ shows that same error message when, this time should show this:

I have repeated several times the steps.
I’m using Python 2.6 and django 1.1 (the same version of the book).
Does anyone have any idea about what I’m doing wrong?
Thank you in advance for any help.
It all seems so simple and straightforward. And yet, does not work!
Here my settings file code:
# Django settings for cms project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'C:\Projetos\cms\cms.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'cms.urls'
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.
'C:/Projetos/templates/',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
)
The answer to all errors was this (thanks, mongoose_za):
“On page 15 [of the book “Practical Django Projects”] you must make sure you edit the example.com site instead of adding a new site. You might have noticed in your settings.py the SITE_ID = 1. If you add a new site 127.0.0.1:8000 then that will have a SITE_ID of 2, and in the following section flatpage views filter by default on the current site which is 1.”
So, I just change
SITE_ID = 2(instead of 1) in settings.py, because I had added a new site 127.0.0.1:8000.After that, I changed the path to my templates folder according to instructions on the book to:
I found the expected result (the blank page “My first page”)
I also have followed this advice:
“On p13 is where the first deviation from the older django kicks in. In your settings.py add ‘django.contrib.flatpages.middleware.FlatpageFallbackMiddleware’, (don’t forget the comma) to your MIDDLEWARE_CLASSES.”
All this was found on this great blog:
http://blog.haydon.id.au/2008/08/2-your-first-django-site-simple-cms.html