Self-paced

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Bootcamp

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Search from all Lessons


LoginGet Started
← Back to Lessons
Edit on Github

Deploy to Heroku using MySQL

Get ready

Deploying to Heroku (takes 7 minutes)

Our templates are% compatible with Heroku, just make sure to understand and execute the following steps:

Get ready

  1. Install Heroku (if you don't have it yet)
1$ npm i heroku -g
  1. Login to Heroku on the command line (if you have not already)
1$ heroku login -i
  1. Create an application (if you don't have it already)
1$ heroku create <your_application_name>
  1. Commit and push to Heroku. Make sure you have committed your changes and push to Heroku
1$ git push heroku master

Environment Variables (takes 2 minutes)

Configuring Env Variables

You cannot create a .env file on Heroku, instead you need to manually create all the variables under your project settings.

Open your .env file and copy and paste each variable (FLASK_APP, DB_CONNECTION_STRING, etc.) to Heroku.

Deploying your database to Heroku (takes 3 minutes)

Create DB on heroku

Your local MySQL Database now has to be uploaded to a cloud, there are plenty of services that provide MySQL database hosting, but we recommend JawsDB because it has a Free Tier, it's simple and 100% integrated with Heroku.

  1. Go to your Heroku project dashboard and look to add a new Heroku add-on.
  2. Look for JawsDB MySQL and add it to your project (it may ask for a Credit Card but you will not be charged as long as you remain withing 5mb database size, enough for your demo).
  3. Once JawsDB is added to your project, look for the Connection String inside your JawsDB dashboard, something like:
mysql://tqqa0ui0cga32nxd:eqi8nchjbpwth82v@c584md9egjnm02sk.5btxwkvyhwsf.us-east-1.rds.amazonaws.com:3306/45fds423rbtbr
  1. Copy the connection string and create a new environment variable on your project settings.
  2. Run migrations on Heroku: After your database is connected, you have to create the tables and structure, you can do that by running the pipenv run upgrade command on the production server like this:
1$ heroku run -a=<your_app_name> pipenv run upgrade

⚠️ Note: Notice that you have to replace <your app name> with your application name, you also have to be logged into Heroku in your terminal (you can do that by typing heroku login -i)