I have everything set up in my local environment and the code for my website up on the Heroku server, I'm just having serious trouble getting the schema to migrate to the PostgreSQL database on the Heroku server. Whenever I attempt heroku run python manage.py migrate
I get the following (this would be an initial migration):
Running python manage.py migrate on baseballstatview... up, run.1653 (Free)
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, statview
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying sessions.0001_initial... OK
Applying statview.0001_initial... OK
Which seems fine but then using heroku pg:info
it tells me I have 0 tables, and even further when I run heroku run python manage.py showmigrations
this is what I get:
Running python manage.py showmigrations on baseballstatview... up, run.5059 (Free)
admin
[ ] 0001_initial
[ ] 0002_logentry_remove_auto_add
auth
[ ] 0001_initial
[ ] 0002_alter_permission_name_max_length
[ ] 0003_alter_user_email_max_length
[ ] 0004_alter_user_username_opts
[ ] 0005_alter_user_last_login_null
[ ] 0006_require_contenttypes_0002
[ ] 0007_alter_validators_add_error_messages
[ ] 0008_alter_user_username_max_length
contenttypes
[ ] 0001_initial
[ ] 0002_remove_content_type_name
sessions
[ ] 0001_initial
statview
[ ] 0001_initial
So it appears that the migrations are not going through and I'm wondering why that's the case. The database is empty, I've tried resetting it and trying again but nothing seems to work.
EDIT: below is the relevant settings.py
for dj_database_url:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mlb_data',
'USER': 'postgres',
'PASSWORD': 'pw',
'HOST': 'localhost',
'PORT': '5432',
}
}
import dj_database_url
DATABASES['default'] = dj_database_url.config()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['*']
DEBUG = False
try:
from .local_settings import *
except ImportError:
pass
dj-database-url
? – Chris Jan 9 at 21:15DATABASE_URL
environment variable on Heroku (make sure to sanitize it to remove the actual host, database name, user, and password)? I realize that's just about everything sanitized, but we need to see it. – Chris Jan 9 at 22:14local_settings.py
was over-ridingsettings.py
– thumbtack_5 Jan 9 at 22:43