This article helps you deploy your first Web application on a remote server. There are many cloud platforms that you can use to deploy your application. AWS by amazon, GCP by Google, Azure by Microsoft, Heroku by Salesforce platform, IBM, Tableau... are some of the behemoths in cloud services.
Most of these platforms provide you with free services too and they only charge you for what you consume. Although most of these cloud services require you to provide credit card information before hand, which some of us are not comfortable with.
Luckily, Heroku lets you use their FREE services without requiring you to provide sensitive credit card information. So, this article helps you use their free services to deploy your first web application. Let's go!!
Step-by-Step process to deploy on Heroku-
1. First step is to DOWNLOAD and INSTALL Heroku CLI first from this link
If you're using macOS, open your terminal and use the following command
$ brew tap heroku/brew && brew install heroku
2. Now CHECK whether Heroku is properly installed by execting the command-
$ heroku --version
3. If you don't already have an ACCOUNT in Heroku. Go ahead and create one -
Now you can login in your web browser by following the link-
4. Now open your terminal and execute the following command-
$ heroku login
It opens you browser and click on login to show this-
You get message that you're successfully logged in.
5. Click on create an app by clicking on New on your right-
6. Name your app. This should be unique since this is deployed globally.
7. Open your terminal and execute the following command by replacing the PATH with your path on your local system of the application you want to deploy-
$ cd /users/PATH
8. Create an environment. You can skip this step and step 9 if you don't want to execute on your local system too-
$ conda create -n environ_name python=3.6.9
If you get a message saying conda: command not recognised. Then use the following command-
$ conda init zsh
Here, python version 3.6.9 is preferred to 3.8 since 3.6.9 is more stable and compatible with existing libraries.
9. Activate the environment and install the libraries required from the requirements.txt file-
$ conda activate environ_name
$ pip install -r requirements.txt
10. Initializing an empty git repository-
$ git init
11. Execute the following to push your app to the cloud git repository-
$ heroku git : remote -a environ_name
$ git add .
$ git commit -am "my first commit"
$ git push heroku master
The folder is pushed to master branch on your cloud and the libraries are installed on the remote server according to your requirements.txt file.
A url is generated and copy the url and hit it on your browser. For example, the link generated for my test application is-
By opening the url you can visit your application-
Thank you for reading!!