Reputation: 1907
I have my app deployed on Heroku and I'm struggling with an error message I get there, but not on my local machine. (They're both running exactly the same code although admittedly the environments are different. One important difference is that locally I build on the same machine as I execute. Heroku does not.)
I've inserted some print statements that attempt to isolate the problem. On my local machine running heroku local
these messages come out as:
6:06:38 PM web.1 | DisasterResponse.db successfully opened.
6:06:38 PM web.1 | Schema Names: ['main']
6:06:38 PM web.1 | Table Names: ['MessageCategorization']
which is great. There's the table, 'MessageCategorization', I create in my release script. Unfortunately that table is missing when I run the code on the Heroku dyno. The same lines come out as:
Oct 01 19:51:38disaster-message-triageapp/web.1 DisasterResponse.db successfully opened.
Oct 01 19:51:38 disaster-message-triage app/web.1 Schema Names: ['main']
Oct 01 19:51:38 disaster-message-triage app/web.1 Table Names: []
Here you can see that schema 'main' is present but and I have no 'MessageCategorization' table.
If you're curious you can examine my repo at https://github.com/manifolded/FigureEightDisasterResponse
I'd welcome advice on how to further diagnose this problem.
Upvotes: 1
Views: 94
Reputation: 484
The problem that I've noticed is that your release commands are executed after each successful build.
But... Release commands are post-build and not part of the build, meaning that once your build is complete a snapshot of the files at that time are the ones that make it to the running dynos.
You can examine the dyno file structure by running heroku run bash
, and then running bash commands like cd
, ls
, etc.
Note:any changes you make this way are temporary and last only during this one-off session
You can either make the release script part of the build by using a bash buildpack (Not sure if it exists), or use a persistent postgres database that heroku provides.See here
Upvotes: 1