Dash Deployment - saving user interaction data

I have a dash app where the user can download some files and I want to keep track of the number of downloads of each file (and a few more things). While in debug mode, running in my laptop, I can save that data in a database fairly easy, using SQLAlchemy. However, when I deploy the app (I’m using Github and Heroku), the database is not updated as the user interactions occur.

How can I accomplish that?

This should be exactly the same as how it is done locally EXCEPT that you need to use a database that is accessible over the internet.

Since you are running on Heroku you will need to use a service that is external to your Heroku dyno. If you ran on a proper virtual machine, which you have control over e.g. Amazon EC2, linode etc you could run the web server and the database together, therefore you wouldn’t need an external service.

You have many options, the simplest is probably using Heroku’s Postgres service since you are running on Heroku https://www.heroku.com/postgres.

Other examples include:

  • google cloud sql
  • amazon rds