Running migrations on production server = FAIL!


#1

Although I haven’t included everything from the first book (this first app doesn’t require it) I have been able to set up the production database and create the settings_production.py file. I’ve made it successfully to the top of page 108, then when I enter

heroku run python manage.py migrate

I get the following long error message:

https://pastebin.com/jv74bg3r

Also, here is my settings.py file:

https://pastebin.com/58kMZMtG

and my settings_production.py file:

https://pastebin.com/VNhC78yX

I can post any other necessary information. Thanks in advance for the help!


#2

After hours of searching for a solution and trying many different commands and changes in code, this is what I got to work: Instead of

DATABASES['default'] = dj_database_url.config()

on the new settings_production.py page, I still imported dj_database_url but used this code directly beneath it instead:

db_config = dj_database_url.config()
if db_config:
    DATABASES['default'] = db_config

My untrained eye doesn’t really understand the difference but all migrations worked. Hope this helps someone else! Cheers


#3

Thanks for the update!