0

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!

mb52089
  • 872
  • 2
  • 10
  • 24

1 Answers1

1

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.

Richard Huxton
  • 21,516
  • 3
  • 39
  • 51
  • I migrated to a new server at webfaction, with pg 9.1 on it. Still the same error message about datetimes. Strange that I can loaddata on my dev setup with pg 9.1 with no issue. Same dumpdata json. I'm stumped – mb52089 Apr 18 '12 at 14:24
  • It's not a PostgreSQL error. Try to get the "bad" value printed out - the problem is either in the data or Python's testing of it. Good news with PG9.1 - lots of improvements in the past few versions. – Richard Huxton Apr 19 '12 at 10:34
  • I manually edited the offending date data and it works now. Still confused why I didn't have to do that for my local install of PG9.1 but did have to do it for webfaction, but oh well. – mb52089 Apr 19 '12 at 14:37
  • If you show *what* changes you made maybe someone could tell you. Are you certain you have all the same versions of all the same modules on each system? – Richard Huxton Apr 19 '12 at 16:28
  • I'm all set now. Everything is working OK. Thanks for the help! – mb52089 Apr 19 '12 at 21:57