How can I tell Django to include tables for my models on a syncdb?

101 views Asked by At

I suspect that I have not imported my models into some place they need to be reported for a syncdb to pick them up.

Where do I need to import my models.py (or otherwise register my models) so that Django will include them on a syncdb?

In models.py, I have:

from django.contrib.auth.models import User
from django.db import models

class CalendarEntry(models.Model):
    description = models.TextField()
    interval = models.IntegerField()
    regular_expression = models.TextField(blank = True)
    scratchpad = models.TextField()
    should_hide = models.BooleanField()
    user = models.ForeignKey(User)
...

When I try to run a syncdb, it doesn't create any tables; the database is empty.

christos@christos-virtual-machine:~/dashboard > python manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
christos@christos-virtual-machine:~/dashboard > sqlite3 *.db
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
sqlite>

What can/should I do so that the syncdb appropriately populates the database?

1

There are 1 answers

0
Rob L On BEST ANSWER

Is the app in INSTALLED_APPS ? Also note that syncdb won't populate tables. It will only create them.