[Answer]-Cannot sync database for Django app on its Heroku postgres database

1๐Ÿ‘

So it turns out the that the problem was that I had another file called local.py in my settings folder for my project. Tree as follows:

โ”œโ”€โ”€ microblog
โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย  โ”œโ”€โ”€ __init__.pyc
โ”‚ย ย  โ”œโ”€โ”€ settings
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ base.py
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ base.pyc
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.pyc
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ local.py
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ local.pyc
โ”‚ย ย  โ”œโ”€โ”€ settings.pyc
โ”‚ย ย  โ”œโ”€โ”€ urls.py
โ”‚ย ย  โ”œโ”€โ”€ urls.pyc
โ”‚ย ย  โ”œโ”€โ”€ wsgi.py
โ”‚ย ย  โ””โ”€โ”€ wsgi.pyc
โ”œโ”€โ”€ Procfile
โ””โ”€โ”€ requirements.txt

Since I was following the Getting Started wit Django Tutorial, I had the following in my local.py file:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': '<user>',
        'PASSWORD': '<pwd>',
        'NAME': '<name>',
        'HOST': 'localhost',
    }
}

That was causing the problem. I tried adding the file to my .gitignore, but that didnโ€™t work. The solution was to actually comment these lines out.

๐Ÿ‘คuser3858526

0๐Ÿ‘

I had the same problem. Commenting local_settings content solved it.

๐Ÿ‘คPVG

Leave a comment