In this blog we will discuss heroku, what it is? And how to deploy the application on it. Let's start.
What is Heroku?
Suppose you have to launch the new application for your business but you don't know how to manage the infrastructure? how to handle storage, networking, monitoring and everything you need to run this new project. Heroku is a Platform as a Service that can handle all of these things for you.
Heroku is a cloud platform as a service (Platform As a Service ) that allows software developers to build, deploy, run and manage enterprise level applications. Heroku is one of the most popular cloud as a service providers which provides the hosting facility with technologies such as python, javascript, Ruby etc. Heroku compared to most of the hosting services is cheaper and very easier to get started with. It avoids the infrastructure headaches to host an enterprise quality application. It acts as an intermediate between hosting/infrastructure and salesforce.
Heroku platform is flexible and easy to use. It provides the simplest way to get the application to the market. Heroku now supports several programming languages such as Python, Java, Nodejs, PHP, Go etc.
It is one of the first cloud platforms. It has been in development since june 2007, when it supported only Ruby programming language. It was initially developed by james lindenbaum, adam wiggins, and orion henry to support the project that were compatible with the ruby programming platform known as Rack. Heroku was acquired by salesforce.com on December 8, 2010.
Why Heroku?
Heroku (Paas) is on top of the AWS to provide the best experience that is specifically designed to make developers' lives easier.For example - To keep the application running on heroku, you have to have knowledge of Heroku CLI and a few commands on the dashboard. This command is easily found on Heroku documentation.
How to deploy applications on Heroku?
Now we are going to show you how to deploy a simple flask project on Heroku.
What we need
Github account with git installed on your machine. To download the git Click here
Heroku account with Heroku CLI installed on your machine. To download the Heroku CLI Click here
Step 2
After the completion of git and heroku CLI installation in your system, then open anaconda command prompt and login with your Heroku account using the following command. When you run this command on anaconda command prompt or in pycharm, you have to press any key, after that browser will open then you can login with your heroku.
Heroku login
When you successfully logged in with your account, then this type of message will be shown.
Step 3
Now set your project path folder and create a virtual environment for your project.
Create a new Git repository
Now Initialize a git repository in a new or existing directory
Step 4
Now run the following command “pip freeze > requirements.txt”. This command will examine your project and add whatever dependencies are needed for your project to requirements.txt file.
Note : Before creating the requirements file you need to install all the dependencies to your project in your virtual environment.
Step 5
Then you have to create a Procfile in your project folder. just type "web: gunicorn app:hello_world". hello_world is my python file name.
Web: gunicorn app:hello_world
Step 6
To deploy the project on the heroku run the following command one by one. When you run the last command at last you will get the link for your application and when you will goto with this link you can see that your flask project is successfully deployed on heroku.
git add .
git commit -m “first commit”
git push heroku master
If you need implementation for any of the topics mentioned above or assignment help on any of its variants, feel free to contact us.
Comments