user3681278
user3681278

Reputation: 135

Django doesn't update postgresql database

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!

Upvotes: 3

Views: 2799

Answers (1)

hY8vVpf3tyR57Xib
hY8vVpf3tyR57Xib

Reputation: 3915

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

Upvotes: 2

Related Questions