Deploy the Flask app on heroku

heroku: Very easy to use PaaS

Try deploying the Deep Learning App deployed on AWS EC2 to previous on heroku ..

Since EC2 is IaaS, it was necessary to install and configure middleware, but with Heroku of PaaS, the same thing can be done in a few lines on the terminal.

Preparation: register heroku and install tools

1. Register on the Official Page

2. Install the CLI Tools (https://devcenter.heroku.com/articles/heroku-cli)

mac


$ brew install heroku

ubuntu


$ sudo apt-get install software-properties-common # debian only
$ sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
$ curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install heroku

3. Log in

$ heroku login

Enter your Heroku credentials:
Email: <your-email>
Password: ********
Logged in as <your-email>

Deploy python app

Create a local repository

$ mkdir heroku-app
$ cd heroku-app
$ pyenv virtualenv 3.6.0 heroku_keras_3.6.0
$ pyenv local heroku_keras_3.6.0
$ echo .python-version >> .gitignore
$ git init

Describe the dependent library in requirements.txt

$ pip install tensorflow keras flask h5py
$ pip install gunicorn # web app. server
$ pip freeze > requirements.txt

Specify python version in runtime.txt

$ echo python-3.6.0 > runtime.txt

Specify how to start the web application in Procfile

$ echo web: gunicorn app:app --log-file=- > Procfile

Deploy to heroku

#$ heroku local web

$ heroku create <app-name>
$ heroku buildpacks:set heroku/python

$ git add -A
$ git commit -m "deploy heroku"
$ git push heroku master
$ heroku ps:scale web=1
$ heroku open

App: https://msrks-numpred.herokuapp.com

Recommended Posts

Deploy the Flask app on heroku
Deploy Flask app on heroku (bitterly)
Deploy the Django app on Heroku [Part 2]
Deploy masonite app on Heroku 2020
Run the app with Flask + Heroku
(Failure) Deploy a web app made with Flask on heroku
Run the flask app on Cloud9 and Apache Httpd
Miscellaneous notes about deploying the django app on Heroku
How to deploy a web app made with Flask to Heroku
How to deploy the easiest python textbook pybot on Heroku
Detect app releases on the App Store
How to deploy a Django app on heroku in just 5 minutes
Deploy flask app with mod_wsgi (using pipenv)
Deploy Django api on heroku (personal note)
[Python] Run Flask on Google App Engine
Easy web app with Python + Flask + Heroku
Change the order of PostgreSQL on Heroku
Getting Started with Heroku, Deploying Flask App
Launch Flask application with Docker on Heroku
[First personal development] The story of deploying the Flask app and Twitter's automatic reply bot on Heroku
Django Heroku Deploy 1
Redis on Heroku
Notes on Flask
shimehari on heroku
A story about deploying a Twitter-linked app created using Flask + gunicorn on Heroku
A memorandum for touching python Flask on heroku
Deploy a Python 3.6 / Django / Postgres web app on Azure
Until you run a Flask application on Google App Engine for the time being
I tried python on heroku for the first time
Deploy a Django application on Google App Engine (Python3)
jsonschema validation on flask
Deploy a Django app made with PTVS on Azure
Django-Overview the tutorial app on Qiita and add features (1)
Deploy a web app created with Streamlit to Heroku
A memorandum of stumbling on my personal HEROKU & Python (Flask)
Sample to put Python Flask web app on Azure App Service (Web App)
Deploy your Go app on Google App Engine with GitHub Actions
Deploy the strongest front-end Streamlit for data scientists on Azure!
Django --Overview the tutorial app on Qiita and add features (2)
Touch Flask + run with Heroku
Install the JDK on Linux
Watch the video on Fedora31
Paste the link on linux
Deploy django project to heroku
Publish the site for free on Google App Engine (personal memorandum)
The record I was addicted to when putting MeCab on Heroku
[Python + heroku] From the state without Python to displaying something on heroku (Part 1)
The road to installing Python and Flask on an offline PC
[Python + heroku] From the state without Python to displaying something on heroku (Part 2)
Deploy Flask servers on virtual machines such as Azure and AWS