How to deploy Python Application on Heroku | Heroku Python Tutorial | Heroku Python Hello World

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome to another video on my youtube channel in this video i will show you how you can deploy your python flask application on heroku and use it for free for getting started heroku is free and if you wish to continue its service you can opt for any paid plan on hiroku so let's get started for this you will need an active hiroku account a github account now on the development side create a folder and open it into any code editor of your choice i will use visual studio code now you need to create a virtual environment it is not compulsory but it's good practice to use virtual environment for different python projects i will use conda in my case let me activate my environment also make sure you have installed flask and guni con that is goonikon in order to successfully deploy python flask application on heroku so let's get started i will create a new file called process web hook dot pi uh i create python flask application specially for google dialogflow and in google dialogflow it is called a webhook so i give the name processwebhook.pi i have a simple code ready a sample helloworld application ready for the demonstration purpose also i have created an images folder and inside that i have a favicon dot png any png file or any image file and i have used this app route favicon ico just to suppress the warnings that it did not get the favicon icon so let's first test this web app and see if it's working or not so it's working let's check it on a browser okay it gives hello world output so this means that the app is working now in order to deploy a python flask web app on heroku you need two things one requirements.txt and proc file from requirement.txt file heroku will understand which packages to install and from proc file it will understand that which python file to run when someone hits the url so let's create a requirements dot txt file let's use freeze and then requirements dot txt requirements dot txt make sure you type it correct okay unknown command freeze oh oops i think it's okay it's freeze i misspelled it second thing let's create a proc file and inside the proc file you need to write this one line web call on gunicon and the file name that you want to run whenever your url is hit in our case it's process web hook don't put the extension dot pi let's save this make sure process dot web hook process dot web hook okay now we will go to github i'll create a new repository hiroku python youtube demo let's say all right this is a repository for my youtube channel you can make the repository public or private don't initialize the repository with readme git ignore or a license file just create a plain repository now inside my application inside my visual studio code i'll write git init okay then git add dot to add everything then git commit dash m let's say initial commit then i'll copy this then get push dash you origin to main oh sorry i write main but i haven't changed the branch let's say git branch dash m main now hopefully it will push all the content on git repository let's check it okay all the files are there let's go to heroku inside new create a new app now there are two ways to deploy the app one is this web interface second using heroku client i usually use this web interface it's easy and clean let's say heroku youtube demo this will be your url for the app let's hit create app after this point you can use heroku client and follow these instruction or you can just hit github and connect your github to hiroku and search let's say i search hiroku uh this is the repository heroku python youtube demo let's connect that repository okay let's deploy the main branch it will take some time to just deploy the whole app from github to hiroku okay our app is deployed let's see if it is working or not okay it gives output hello world so that means the app is working one more thing inside settings you can see configuration words and you can use any key value pair here and inside your python application you can use that environment variables using process dot env command and you can search more on that on internet so i hope this gives you a clear idea on how you can deploy your python flask application on hiroku platform thank you for watching peace
Info
Channel: Raj Kapadia
Views: 5,735
Rating: 4.6551723 out of 5
Keywords: heroku python, python app deployment, python heroku app hosting, heroku python tutorial, heroku tutorial, python tutorial
Id: x8hVoalU0MA
Channel Id: undefined
Length: 10min 0sec (600 seconds)
Published: Mon Mar 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.