Domanda

I am trying to work my way through the official Django tutorial (https://docs.djangoproject.com/en/1.5/intro/tutorial01/) but I'm running into a problem when trying to use the shell.

Specifically, when I try to run python manage.py shell I get the error "InterfaceError: Error binding parameter 0 - probably unsupported type."

I don't know what this means, and the only code I've written is the example code given in the tutorial:

from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

    def __unicode__self():
        return self.question

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)

    def __unicode__(self):
        return choice_text

I also encountered the problem "SQLite received a naive datetime while time zone support is active." but I used an answer from another SO post to ignore that warning and I don't think that's what's causing this InterfaceError.

I'm running Django 1.5 with Python 2.7 on Ubuntu 12.10 and using sqlite3. If anyone has any ideas as to what's going on I'd really appreciate the help.

È stato utile?

Soluzione

I had the same problem. Make sure you have a valid time zone in the mysite\settings.py file.

I followed the link http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE given on the Django tutorial. However, those keywords don't work with sqlite.

Look up the time zones on http://en.wikipedia.org/wiki/List_of_tz_zones_by_name. For me it's America/New_York.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top