3

I recently switched form a SQL Lite DB to a Postgresql DB for my Django project. I was not far in, so I did no migrations and just started with a clean DB. I followed the instructions found here https://stackoverflow.com/a/5421511/3681278

Things are going swimmingly and things updated and added via PGAdmin III are showing up in the admin screen. When I attempt to add models and run a sync db, it does not fail, executes and seems to work, but nothing in the database is changed.

Also, posting changes via models that would normally add/change/update/delete database entries have no effect.

I have search high and low for a solution to no avail.

A hopefully helpful clue:

When I change a model name or delete a model I am asked if I want to delete the old models. So, the models must be generating some table somewhere, but once again there is no effect on the postgresql database.

Here is my settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'RED_DB',
        'USER': 'postgres',
        'PASSWORD': 'MyPass',
        'HOST': ''
    }
}

Thanks in advance!

Community
  • 1
  • 1
user3681278
  • 135
  • 1
  • 4
  • 11
  • 2
    Are you [committing your transaction](https://docs.djangoproject.com/en/1.7/topics/db/transactions/)? – hd1 Jun 30 '14 at 18:07
  • Are you sure you're connecting to the same database from Django that you are from PgAdmin-III? – Craig Ringer Jul 01 '14 at 02:00

1 Answers1

2

Sync db isn't a command that you can run after you have modified the models (migrations), most developers use a tool called south. This is a pluggable app for Django that handles the migration.

EDIT: Since Django 1.7 migrations are supported, take a look the documentation: https://docs.djangoproject.com/en/dev/topics/migrations/ .

hY8vVpf3tyR57Xib
  • 3,574
  • 8
  • 41
  • 86