dimanche 18 octobre 2015

Converting sqlite3 database to postgresql in Django

In my models.py file I have:

class Book(models.Model):
    weeks_list = models.TextField(max_length=1000)

In my settings.py file I have:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'db_name',                      
        'USER': 'user',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '',
    }
}

I have been using sqlite3 with a file called db.sqlite3. I wanted to switch to postgresql. When I try syncdb, I get the following error:

psycopg2.ProgrammingError: column "weeks_list" cannot be cast automatically to type date

HINT:  You might need to specify "USING weeks_list::date".

I'm not sure what to do.

Aucun commentaire:

Enregistrer un commentaire