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!

2
  • 2
    Are you committing your transaction? Commented Jun 30, 2014 at 18:07
  • Are you sure you're connecting to the same database from Django that you are from PgAdmin-III? Commented Jul 1, 2014 at 2:00

1 Answer 1

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/ .

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.