Question

i recently converted a project's database from sqlite to postgres, because of timezone issues. The conversion works fine in my local dev environment. However, in my production environment on webfaction, when I try to use loaddata to populate the db from my json file, I get the following error message:

Problem installing fixture 'smartcarpools.json': Traceback (most recent call last):
  File "/home/mb52089/webapps/smartcarpools_prod/lib/python2.7/django/core/management/commands/loaddata.py", line 169, in handle
    for obj in objects:
  File "/home/mb52089/webapps/smartcarpools_prod/lib/python2.7/django/core/serializers/json.py", line 35, in Deserializer
    for obj in PythonDeserializer(simplejson.load(stream), **options):
  File "/home/mb52089/webapps/smartcarpools_prod/lib/python2.7/django/core/serializers/python.py", line 128, in Deserializer
    data[field.name] = field.to_python(field_value)
  File "/home/mb52089/webapps/smartcarpools_prod/lib/python2.7/django/db/models/fields/__init__.py", line 710, in to_python
    raise exceptions.ValidationError(self.error_messages['invalid'])
ValidationError: [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']

I noticed that webfaction uses postgres 8.3 while my local dev environment uses 9.1.

Any help for a beginner is greatly appreciated. Thanks!

Was it helpful?

Solution

I don't see anything mentioning PostgreSQL in your error. It is complaining about not having a valid date/time. Have you checked to make sure smarcarpools.json has all its date-times in "YYYY-MM-DD HH:MM" format?

Oh - and PostgreSQL 8.3 was released back in 2008. You will want to:

  1. See if webfaction (a hosting company?) offer something more current
  2. Read the release notes for versions 8.4, 9.0, 9.1 so you have some idea of what is different. Bear in mind that you can't simply dump a 9.1 database and load it into 8.3, although you should be able to go the other direction.

If you can't get an up-to-date version on your host, grab a copy of 8.3 for your platform - if you're on a unix system then compiling from source is simple enough.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top