2

I'm trying to deploy a Flask app to Heroku. My app runs a MySQL database and it all is good locally but cannot figure out how to make it work in Heroku. I attached the ClearDB package to my app in Heroku and created the proper tables in the database by ClearDB replicating my local structure. I also changed my variables in my app.py file from the local ones to these:

# Local MySQL variables
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'my_local_username'
app.config['MYSQL_PASSWORD'] = 'my_local_password'
app.config['MYSQL_DB'] = 'my_local_DB'
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'

# Variables for remote DB
app.config['MYSQL_HOST'] = 'my_clearDB_host'
app.config['MYSQL_USER'] = 'my_clearDB_username'
app.config['MYSQL_PASSWORD'] = 'my_clearDB_password'
app.config['MYSQL_DB'] = 'my_clearDB_DB'
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'

mysql = MySQL(app)

The app isn't working (I'm not surprised, it would have been too easy!!).

Could anyone let me know what step(s) I am missing or what I should be doing different?

Thanks so much!

Guillermo Brachetta
  • 3,857
  • 3
  • 18
  • 36

0 Answers0