So I made a change locally and then pushed to github and heroku, then when I accessed my live heroku project I noticed that the database was oddly reverting to the objects that I had during my local development.
This very well could be because I didn't set up my heroku postgresql db correctly (this is my first time setting up a heroku postgresql with django).
Here is a snippet from my Settings.py, please assume the information in brackets:
ON_HEROKU = os.environ.get('ON_HEROKU')
HEROKU_SERVER = os.environ.get('HEROKU_SERVER')
if ON_HEROKU:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '<the name is here>',
'USER': '<user is here>',
'PASSWORD': '<password is here>',
'HOST': '<host is here>',
'PORT': '<port is here>',
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
I ran a syncdb, and it seems to do nothing. :
(venv)$ heroku run python manage.py syncdb --account personal
Running `python manage.py syncdb` attached to terminal... up, run.7965
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
For the record, the first time I ran syncdb, it seemed to never set up a new user, rather it just tried to install more tables. I don't know why, but this seems like a red flag.
I have also run the following commands to check if the postgres db is there:
(venv)$ heroku addons --account personal | grep POSTGRES
heroku-postgresql:hobby-dev HEROKU_POSTGRESQL_COBALT
Even though everything seems to be okay, my project is using SQLite db on live. I must be missing something. Any advice appreciated. I can show more if needed.