I created custom django-admin command. I use this tutorial Writing custom django-admin commands
For example, my command:
import os
from home.models import BuildTask
class Command(BaseCommand):
def handle(self, *args, **options):
tasks = BuildTask.objects.all()
os.system("touch /Users/macbook/Desktop/Start.txt")
if tasks:
os.system("touch /Users/macbook/Desktop/TasksExist.txt")
else:
os.system("touch /Users/macbook/Desktop/TasksNotExist.txt")
os.system("touch /Users/macbook/Desktop/End.txt")
when i run this command by use terminal:
python manage.py build_task
everything is OK, i get 3 files on Destop.
But when i use crontab,
* * * * * /usr/bin/python /Users/macbook/builder/manage.py build_task
i just get 1 file on Desktop("Start.txt"). Apparently the script stops job on the line.
if tasks:
Please help me. What's the problem?
Update: /var/mail/macbook:
File "/Users/macbook/workspace/acodebuilder/home/management/commands/build_apk.py",
line 26, in handle
if tasks:
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 113, in
__nonzero__
iter(self).next()
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 107, in
_result_iter
self._fill_cache()
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 772, in
_fill_cache
self._result_cache.append(self._iter.next())
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 273, in
iterator
for row in compiler.results_iter():
File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 680, in
results_iter
for rows in self.execute_sql(MULTI):
File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 735, in
execute_sql
cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/django/db/backends/util.py", line 34, in
execute
return self.cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", line 234,
in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: home_buildtask
Why "no such table" ?
You should be able to see the error output of the command (if there was any) by running the mail command. Alternatively, you can append &> ~/Desktop/django-command-error.log to the crontab entry and the error output of the cron job will be saved to django-command-error.log on your desktop.
it's issue caused by SQLite db, We must use MySQL or PGSQL!
Related
I'm trying to deploy my first small django app to heroku. I'm following a tutorial from djangogirls: http://tutorial.djangogirls.org
I'm able to create the app and login as admin on my local computer. When I deploy to heroku and try to login as admin, I get an error saying there is no such table for auth_user:
OperationalError at /admin/login/
no such table: auth_user
Request Method: POST
Request URL: https://intense-river-2803.herokuapp.com/admin/login/?next=/admin/
Django Version: 1.7.5
Exception Type: OperationalError
Exception Value:
no such table: auth_user
Exception Location: /app/.heroku/python/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 485
Python Executable: /app/.heroku/python/bin/python
Python Version: 2.7.9
Python Path:
['/app',
'/app/.heroku/python/bin',
'/app/.heroku/python/lib/python2.7/site-packages/setuptools-11.3.1-py2.7.egg',
'/app/.heroku/python/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg',
'/app',
'/app/.heroku/python/lib/python27.zip',
'/app/.heroku/python/lib/python2.7',
'/app/.heroku/python/lib/python2.7/plat-linux2',
'/app/.heroku/python/lib/python2.7/lib-tk',
'/app/.heroku/python/lib/python2.7/lib-old',
'/app/.heroku/python/lib/python2.7/lib-dynload',
'/app/.heroku/python/lib/python2.7/site-packages']
Server time: Sat, 28 Feb 2015 15:40:42 -0800
I think I'm able to migrate the database ok, but createsuperuser is a problem.
(env) C:\Users\dougw_000\SkyDrive\MyDjangoSite>heroku run python manage.py migra
te
Running `python manage.py migrate` attached to terminal... up, run.4246
Operations to perform:
Apply all migrations: sessions, contenttypes, blog, admin, auth
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying blog.0001_initial... OK
Applying sessions.0001_initial... OK
(env) C:\Users\dougw_000\SkyDrive\MyDjangoSite>heroku run python manage.py creat
esuperuser
Running `python manage.py createsuperuser` attached to terminal... up, run.3724
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/_
_init__.py", line 385, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/_
_init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/mana
gement/commands/createsuperuser.py", line 55, in execute
return super(Command, self).execute(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 338, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/mana
gement/commands/createsuperuser.py", line 88, in handle
default_username = get_default_username()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/mana
gement/__init__.py", line 174, in get_default_username
auth_app.User._default_manager.get(username=default_username)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager
.py", line 92, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.p
y", line 351, in get
num = len(clone)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.p
y", line 122, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.p
y", line 966, in _fetch_all
self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.p
y", line 265, in iterator
for row in compiler.results_iter():
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/com
piler.py", line 700, in results_iter
for rows in self.execute_sql(MULTI):
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/com
piler.py", line 786, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils
.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils
.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", lin
e 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils
.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/sqlit
e3/base.py", line 485, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: auth_user
(env) C:\Users\dougw_000\SkyDrive\MyDjangoSite>
Firstly, find and delete all pyc files locally. Tell your .gitignore file to ignore pyc files in the future and finally push your changes to heroku.
So, to remove the pyc files, in a UNIX like system (linux, OSX), run this command in your terminal inside your djangogirls folder:
find . -name "*.pyc" -exec rm -rf {} \;
Then go to your .gitignore file and add this line:
*.pyc
Then do:
git add -A .
git commit -m "Remove pyc files"
git push heroku master
The tutorial ommits to tell you to add "*.pyc" to your gitignore and this confuses Heroku, a lot.
I had the same issue and this is how I solved it.
Let me know if it worked!
I have bunch of tasks that I need to launch using another shell script.
I want to run the shell script using nohup mode, but the fabric refuses continue as there is no stdin
Traceback (most recent call last):
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/main.py", line 743, in main
*args, **kwargs
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 368, in execute
multiprocessing
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 264, in _execute
return task.run(*args, **kwargs)
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 171, in run
return self.wrapped(*args, **kwargs)
File "/home/ubuntu/utils/deploy_to_ubuntu/deploy_worker.py", line 84, in deploy_existing
run('sudo sh ~/existing_setup.sh')
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/network.py", line 578, in host_prompting_wrapper
return func(*args, **kwargs)
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 1042, in run
shell_escape=shell_escape)
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 911, in _run_command
stderr=stderr, timeout=timeout)
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 795, in _execute
worker.raise_if_needed()
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/thread_handling.py", line 12, in wrapper
callable(*args, **kwargs)
File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/io.py", line 215, in input_loop
byte = msvcrt.getch() if win32 else sys.stdin.read(1)
IOError: [Errno 9] Bad file descriptor
I do not need stdin to be present for any of the terminals.
I am running fabric in the shellscript using --no-pty option but it is not helping at all
It is simply not possible to not run this nohup mode because it will take about 10 hours I do not want a terminal to be open for so long.
shellscript looks something like this:
fab --no-pty deploy.add_new_server
python runtests.py
python add_another_server_to_config.py
fab --no-pty deploy.add_new_server
python runtests.py
.
.
.
and I run nohup deploy_and_test.sh &
It was simple.
nohup deploy_and_test.sh </dev/null &
I'm having strange error with installing fixture from dumped data. I am using psycopg2, and django1.1.1
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 153, in handle
obj.save()
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 163, in save
models.Model.save_base(self.object, raw=True)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 495, in save_base
result = manager._insert(values, return_id=update_pk)
File "/opt/local/lib/python2.5/site-packages/django/db/models/manager.py", line 177, in _insert
return insert_query(self.model, values, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 1087, in insert_query
return query.execute_sql(return_id)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql
cursor.execute(sql, params)
File "/opt/local/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: can't adapt
First I've checked similar issues on internet. This one seemed to be very related: http://code.djangoproject.com/ticket/5996, as my data has many non ASCII symbols
But actually I've checked my django installation and it's ok there
Could you advice what is wrong
====
Continued investigation after added print statement as suggested by the first answer. Log looks this way:
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
<DeserializedObject: Novice>
<DeserializedObject: Junior>
<DeserializedObject: Chess enthusiast>
<DeserializedObject: Experienced player >
<DeserializedObject: Smart player>
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 153, in handle
print obj
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 155, in __repr__
return "<DeserializedObject: %s>" % smart_str(self.object)
File "/opt/local/lib/python2.5/site-packages/django/utils/encoding.py", line 107, in smart_str
return str(s)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 335, in __str__
return force_unicode(self).encode('utf-8')
File "/opt/local/lib/python2.5/site-packages/django/utils/encoding.py", line 71, in force_unicode
s = unicode(s)
File "/Users/oleg/Sites/probsbox/registration/models.py", line 58, in __unicode__
return u"%s's profile" %(self.user.username)
File "/opt/local/lib/python2.5/site-packages/django/db/models/fields/related.py", line 257, in __get__
rel_obj = QuerySet(self.field.rel.to).get(**params)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 305, in get
% self.model._meta.object_name)
DoesNotExist: User matching query does not exist.
silver:probsbox oleg$
Error from very last comment
<DeserializedObject: qwert2000's profile>
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 154, in handle
obj.save()
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 163, in save
models.Model.save_base(self.object, raw=True)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 495, in save_base
result = manager._insert(values, return_id=update_pk)
File "/opt/local/lib/python2.5/site-packages/django/db/models/manager.py", line 177, in _insert
return insert_query(self.model, values, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 1087, in insert_query
return query.execute_sql(return_id)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql
cursor.execute(sql, params)
File "/opt/local/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: can't adapt
The can't adapt error is raised by psycopg2 when it receives an data type that it doesn't know how to translate into a value for a SQL statement. For example, if you accidentally pass a list, say, for a value that is supposed to be an integer, psycopg2 will raise this can't adapt error.
The faq.txt document that ships with the source distribution of psycopg2 explains it this way:
Why does !cursor.execute() raise the exception can't adapt?
Psycopg converts Python objects in a SQL string representation by looking
at the object class. The exception is raised when you are trying to pass
as query parameter an object for which there is no adapter registered for
its class. See :ref:adapting-new-types for informations.
Probably your best first-pass at finding the offending value is to run loaddata in fully verbose mode: python manage.py loaddata --verbosity=2 /Users/oleg/probs.json
Well, I was hoping loaddata verbosity would work and I wouldn't have to confess that I've never found an elegant way of debugging adaptation errors with django's loaddata. In the past, I've resorted to inserting print statements in django's loaddata function so that I can see the values being deserialized when the error occurs. I've edited django/core/management/loaddata.py. Look of obj.save() in the handle() function. I hope this confession inspires someone to share a better solution :-)
Ok, I ended copying dump from my database, and restoring it locally without python...
I have new to python and django I am creating poll application and in that application after creating models poll and choice using "South". I want to changer the length of question field from 200 to 300 but I am not able to achieve it even using south as well.
I have run python manage.py schemamigration polls --initial command to create migration file then I make change in poll question field that is (question = models.CharField(max_length=250)) change max_length from 200 to 250.
and the again run python manage.py schemamigration polls --auto this will generate new migration file.
after that all stuff I run python manage.py migrate polls and it shows following error :
C:\Python26\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated
from sets import ImmutableSet
Running migrations for polls:
- Migrating forwards to 0003_auto__chg_field_poll_question.
> polls:0003_auto__chg_field_poll_question
! Error found during real run of migration! Aborting.
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
! You *might* be able to recover with: = ALTER TABLE `polls_poll` ; []
= ALTER TABLE `polls_poll` MODIFY `question` varchar(200) NOT NULL;; []
= ALTER TABLE `polls_poll` ALTER COLUMN `question` DROP DEFAULT; []
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS.
! NOTE: The error which caused the migration to fail is further up.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line
362, in execute_manager
utility.execute()
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line
303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 195,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 222,
in execute
output = self.handle(*args, **options)
File "C:\Python26\lib\site-packages\south\management\commands\migrate.py", lin
e 109, in handle
ignore_ghosts = ignore_ghosts,
File "C:\Python26\lib\site-packages\south\migration\__init__.py", line 202, in
migrate_app
success = migrator.migrate_many(target, workplan, database)
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 220, i
n migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, datab
ase)
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 291, i
n migrate_many
result = self.migrate(migration, database)
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 125, i
n migrate
result = self.run(migration)
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 99, in
run
return self.run_migration(migration)
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 81, in
run_migration
migration_function()
File "C:\Python26\lib\site-packages\south\migration\migrators.py", line 57, in
<lambda>
return (lambda: direction(orm))
File "C:\mysite\..\mysite\polls\migrations\0003_auto__chg_field_poll_question.
py", line 12, in forwards
db.alter_column('polls_poll', 'question', self.gf('django.db.models.fields.C
harField')(max_length=250))
File "C:\Python26\lib\site-packages\south\db\generic.py", line 330, in alter_c
olumn
self.delete_foreign_key(table_name, name)
File "C:\Python26\lib\site-packages\south\db\generic.py", line 588, in delete_
foreign_key
constraints = list(self._constraints_affecting_columns(table_name, [column],
"FOREIGN KEY"))
File "C:\Python26\lib\site-packages\south\db\mysql.py", line 140, in _constrai
nts_affecting_columns
""", [db_name, table_name, type])
File "C:\Python26\lib\site-packages\south\db\generic.py", line 134, in execute
cursor.execute(sql, params)
File "C:\Python26\lib\site-packages\django\db\backends\util.py", line 19, in e
xecute
return self.cursor.execute(sql, params)
File "C:\Python26\lib\site-packages\django\db\backends\mysql\base.py", line 84
, in execute
return self.cursor.execute(query, args)
File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 168, in execute
if not self._defer_warnings: self._warning_check()
File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 82, in _warning_
check
warn(w[-1], self.Warning, 3)
_mysql_exceptions.Warning: Can't find file: 'slow_log' (errno: 2)
Please help me
0003 Look like :
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Poll.question'
db.alter_column('polls_poll', 'question', self.gf('django.db.models.fields.CharField')(max_length=250))
def backwards(self, orm):
# Changing field 'Poll.question'
db.alter_column('polls_poll', 'question', self.gf('django.db.models.fields.CharField')(max_length=200))
Ansh J
Go modify the mysql table from the mysql console already!
python manage.py dbshell
alter table appname_modelname modify `question` varchar(200) NOT NULL;
To be able to answer this question with any certainty you'll need to show migrations 0002 and 0003...
However, it seems to me the resulting exception is simply a problem with MySQL (it cannot find its 'slow log') that creates a warning that is propagated to south, which trips over it.
The problem you're having is not in Django or South, it's in MySQL. MySQL is coughing up the following:
_mysql_exceptions.Warning: Can't find file: 'slow_log' (errno: 2)
and it's panicking the MySQLdb library, which is triggering the bailout, even though it's just a warning.
You need to find out why MySQL is so concerned about its missing slow_log file.
I suspect that you likely have general_log and slow_log frm files within
the mysql database directory, without any corresponding data files. If
this is the case then just 'rm' the general_log.frm and slow_log.frm
files from the mysql database directory, and all these errors should go
away.
I'm trying to set up OpenID authentication in Django, using django-authopenid.
The instructions are pretty good, but having followed them and made all the requisite changes in settings.py and added the required templates, my whole site is now showing a 500 error, having previously worked fine. The Apache logs show:
Exception occurred processing WSGI script '/usr/local/www/wsgi-scripts/myapp.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 73, in get_response
response = middleware_method(request)
File "/usr/local/lib/python2.6/dist-packages/django_authopenid-1.0.1-py2.6.egg/django_authopenid/middleware.py", line 36, in process_request
request.associated_openids = [rel.openid_url for rel in rels]
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 93, in _result_iter
self._fill_cache()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 660, in _fill_cache
self._result_cache.append(self._iter.next())
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 207, in iterator
for row in self.query.results_iter():
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 287, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 2345, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: relation "django_authopenid_userassociation" does not exist
Looks like a SQL error (I'm not a django expert)?
It's possible I've put my templates in the wrong place, the instructions aren't very clear. I just added two new directories, registration and openauthid, in the main templates folder.
Bit baffled - can anyone help? Thanks!
It looks to me like you've not yet set up the required tables. Try running:
python manage.py syncdb
from the project directory.