I am trying to build a full-stack web application using Python and Heroku.
There are two apps and they are connected using a common database (Heroku Postgres). The backend app streams live tweets from twitter and stores them in a database. In the frontend plotly-dash app, users can give an input query and the sentiments of the query are displayed in real-time. The app is perfectly running on my local server. But when I try to deploy it in Heroku, I am finding difficulty in deploying the two apps.
Am I supposed to deploy the apps separately using two applications? If so, how can I connect to the common database?
Am I supposed to deploy the apps separately using two applications?
Yes.
Heroku is designed to deploy one service at a time. One application per application.
If so, how can I connect to the common database?
Create one application with a Heroku Postgres addon, then add a second application to the existing database:
heroku addons:attach <heroku-addon-name> -a <app-name>
Related
I have a web application written in Python-Flask with database created using MySQL. I have deployed my app using Heroku but it's only the frontend and backend part. I also need to upload database so that the app can interact with the database. I have searched many videos on YouTube but nothing came as useful. Most of them are using Postgre SQL both in local and heroku app but I've an MySQL database with me. I need help how can I connect my app to my database.
Heroku has native support for postgessql not mysql, so you might want to change to that or use the Clear DB addon as explained in the docs.
From heroku
"Heroku provides three managed data services to all customers:
Heroku Postgres, Heroku Redis, Apache Kafka on Heroku"
Also have a look at this previous answer that targets the same issue.
I'm starting a new project using Django and hosting it on Heroku. I know that Django comes with a SQLite db ready to use for the application to store all of the app's data.
Heroku requires PostgreSQL - does this mean that my app will have to be configured locally to use this database INSTEAD OF the SQLite db - or does it use both? Is the PostgreSQL db just something that the Heroku app needs to work or do you actually need this to run your Django app in Heroku?
Thanks!
Found answer on https://devcenter.heroku.com/articles/sqlite3. Heroku uses/prefers postgres and not sqlite.
I have deployed a reasonably simple flask app as an Azure Web App. I have opted to have the deployment of updates controlled by a Github branch.
As the app requires little data management, I have used a sqlite database.
I have updated the database since the original deployment and so need to complete a flask db migrate on the SQLite database.
Can I perform a sqlite database update on Azure and if so how?
I have tried logging into the ssh shell for the web app via the Azure portal, moving to the wwwroot directory and trying to do a flask db update, but flask-migrate is not installed so flask db is not recognised (even though it is in the requirements.txt file)
I wrote a little bottle web application, played around with setup.py, and I'm ready to deploy.
I had two questions:
How do I deploy this new web app in production? Do I need a a webserver or reverse proxy? Can my main.py be run as a service? How is this typically done?
My web app uses a mongodb backend. Is there a way to package that with my application or to require it / look for it / alert the user when the installer runs? How is this typically done?
Pythonanywhere allows you for free to test/deploy a Bottle app with Pymongo driver. This is one of the webhostings which is python-deployers friendly... If you need something for a serious trafic, then you have to consider a paid programm or your own (virtual/dedicated) hosted server.
I ran my Bottle applications on OpenShift. There's a quickstart template on GitHub for getting a Bottle application online. You could just copy their directory structure and files, add your own, and send it all to the git repository that is created for you. OpenShift uses git when it comes to development, so if you ever make any changes, you just need to commit and push them to the server again.
MongoDB and RockMongo (a GUI for managing your MongoDB database, similar to phpMyAdmin for MySQL) are built in. You get three 'gears' or instances to work with, so the Bottle application will be one, with MongoDB and RockMongo included. You just have to enable them.
I am in the process of migrating my python application from Google App Engine to Heroku. I have managed to get webapp2 (google app engine's default request handler) working.
What I am experiencing an issue with, is the database. In GAE, I was using the built in Datastore, and my application contains all the database syntax according to that. But after migrating to Heroku, I have a lot of database choices as "addons".
I wanted to know, as to which database I should choose in Heroku, which resembles the Google App engine's datastore the most, so that I have to change the least amount of code in my Application.
Just as a reference, here's the link showing the vast amount of options available on Heroku for database choices: Heroku Database Addons.
Something like Cassandra: https://addons.heroku.com/cassandraio would be closest in performance to the GAE datastore given it's column-structured nature.
However, depending on your usage patterns and how close you stuck to the Django-like API, any of the standard datastores (Postgres, ClearDB MySQL) would be about the same amount of effort to switch over to from a code perspective.