Mission: Deploy Rideminder
After all the excitement and celebration of graduation - I knew that I wanted to get my baby, Rideminder, out into the world! So I had to do a couple of things to set him up to be ready.I had support from Christina to get my PostgreSQL running locally. Now I needed to get it looked up on Heroku. Easier said than done. I was able to get into PostgreSQL but not get my tables going. It kept getting errors with my db.create_all() function that for sqlite would create my table, but in PostgreSQL it wasn't working. It turns out my notes were not clear on how to create my table. I had to look it up and see that I need to manually create my table. This took a bit - when I tired to put items into my database, the types were wrong. SQLite isn't picky; I needed to changed my datatype to actually be right - what a thought!Cool, now I need to figure out Celery on heroku. I researched a couple of places (starting with Heroku's docs on Celery) and I watched a reallygood video by Max Mautner of a simple celery process being created and uploaded onto Heroku. This was a couple of days process (a little on one day, a little over here, but not much, actually sit down for a chuck of time). Getting RabbitMQ for my celery to work on was super easy; they have a free option(with the cutest icon ). I connected my task to the rabbitmq and it wasn't working. It wasn't connecting to my datbase and it kept getting errors because kombu (a library that celery uses) was erroring out (ImportError: cannot import name _uuid_generate_random). I researched the library and I pip installed kombut, but it was the 3.0.29 version and the error is fixed on the 3.0.30 version. So I looked online and there were several sites that said to download their package to get the latest one because python hasn't updated it yet. I felt funny about this and I emailed Joel my issue and what I had found. He simply wrote back:
"in your requirements.txt file, add “kombu==3.0.30” That tells Python you need a certain version of a library"
Beautiful! I did that and it worked! Yeah! Thanks Joel! So the next day I was able to pip install my requirements with the updated library and viola! Celery is going! Its not connected to my postgres database but it lives!I spent some time tweaking my task file and how it connects to my database and it turns out, I totally created my postgres database, but I forgot to actually change my model connection to sqlite to postgres. So now that its actually connected. My celery is working! YEAH!After a few minutes, I noticed that my distances were not changing. I looked up Firebase and the transit data isn't updating. Oh no! All my work and the day I get it going, is the day that Firebase doesn't work. Good thing I have already planned my next feature to include a call to google direction api to get the estimated time it would take to go from the user's geolocation to the destination geolocation using their transit mode. So I'll have Rideminder's celery check the distance and the time and which ever meets the threshold first, sends out my twilio text and changes the request in the database as complete. So I disabled my celery (that way it doesn't keep calling to Firebase, since its down).To Do: Call Google direction api and get just the estimated time, figure out datetime, update my database to save the time, change celery to check the time, let the world know of Rideminder