Transcripts
1. Video 1 Introduction: Hey guys, my name is or pidgin and I'm a data scientist working with a startup, 3M when we're talking about how to create your own website using Python and make it live in just five minutes, totally free of cost. So without waiting, Let's jump ahead. The seller technology stack that we're going to use. So mostly it is Python. And within Python we are going to use a module called stream that I'll talk about it a bit later. We'll use GitHub to store our repository and the code. And then when you will use Heroku, deploy our application. These are broadly the steps that are involved. So we'll create a test application and check, check locally. We'll prepare application bot deployment will publish the application, the codebase to GitHub and then redeploy using ketones. So see you in the next video.
2. Video 2 Creating a Local Version of your WebApp / Website: Before we actually jump into the coding, we will talk about what stream that is. So FIM rate is actually a startup, be sort of California, I guess. They are actually creating a way to Bill and share data apps, more specifically applications for machine learning. But this can also be leverage as a tool to create our own website, a small blog or something as we'll talk about that later. But that is what stream letters all about. It's as easy to start with installing the module using pip install, and then we'll see how it goes. I would prefer that you activate conda environment or 0, any worthwhile environment and new. In that virtual environment, you can just do a pip install, streamlined. And it will run. So my is already there. So it just say that everything is satisfied, clear the terminal. And once you have that installed, you need to go off to go to a folder where the application is present. That folder is present inside that folder to say it boat streamlined as st. Uh, let me see if this folder, so one thing to remember is looming this folder, you have to name it. I'm the same way you want to see it. So let's see I am, I want to see it as a test app, so I just write test app.py. So I've imported my stream late. I have to define a main function, which basically server will call Definitely, and I will just write sd dot tried. Hey, this is the demo of stream live. And will basically call this function indefinitely. Saying, I mean, yeah, and I'll just call this function. So once I've saved this function, I just need to run this file using Stream late. So what I'll do is I'll go to my terminal. I'm already in the folder in which this file is present, which is test.py. I just need to write stream. Let run app.py, press Enter. What it will do is basically create an app on this address which can be accessed using this locally. So if you go to localhost port 8500 one, you should see your app, which is this right here. So whenever you make a change in the code, let's say I'm adding some markdown contents. So maybe just giving it a heading three kind of attack. As saved. As soon as I save the file, it detects that the source file has been changed and you can rerun the app. So this will basically give you the better thing. So this is a very basic app, minimal app. You can just play around with settings. For example. It can show the app and white mode and so on and so forth. So the latest version of streamline, it has 0 team as well, too dark and light mode. I'm not using the latest version here, but you can use that. So this is how we create a very quick demo website. Of course, this is an eight line code, but you can make it more complicated by adding things, adding buttons and so on and so forth. And maybe do what later. We don't want this on stream it itself, but this video is mostly talking about how to use streamed to deploy and just deploy it on the website. So see you in the next video.
3. Video 3 Preparing WebApp/Website for Deployment: Hey everyone, welcome to the next video. So if you remember in the last video we created a demo stream that up. This is how I hope it was running fine locally. Now what we're gonna do in this video is basically prepared this app for deployment to Heroku. So there are a few files that you need to add to this folder. And I talk about those files step-by-step. So I have this repository that I created using stream that it has all the files I'm just going to refer to pause a tree and I'll give a link of this repository towards the end. So firstly, you need a proc file. Procfile essentially tells which file to run, which file to look for when you're running the stream NetApp. So I'll just copy the contents of this file and paste a pair. And if you see it says that use a setup produsage file and then stream natron. Whatever the name of your app is when my case, it's test underscore app, which should match the app that I'm used to run shame that file. So I'll do that adding rest all are the same. The only change that you have to make is to make sure you change the name of this file. Once I save this, I just need to save it In filename, proc file. And we have it right there. Alright, we have Procfile nesting. We need to have is a requirements file. So this is just telling the Heroku what all requirements do we need. So here we just need to simulate, that's all pandas. Numpy a XML is not something that we need. But you can add this if you're making a complicated app. Whatever the requirements are, you can just add that. So I just saved this requirement Pfizer file as well. All right, the next thing we have to do is basically specify a runtime. So let's say we specify a Python 3.6.13 version. So we do that and algaes save this file and runtime dot TXT. Here we go. And the last file is the setup dot SH file. It basically contains some commands about streamed, right? You know how to install screamed at and Heroku. We definitely don't need to sort of dive deep into this right now. And we don't have to change anything as file, it's just to be present hazardous. So maybe talk about this file and more in a more advanced video, but we just need to create this file. So just to reiterate, we have to create four extra files, Procfile requirements, runtime and setup dot SH. You need not remember everything, but you just want to make sure that you change the variables appropriately, wherever relevant, and add entity, any module that you're using, or if your application support or specific Python version, and that's about it. So in this case, we have prepared our application for deployment and we'll publish it to GitHub and we'll see how to deploy it. So see you in the next video.
4. Video 4 Publishing to GitHub: All right, so we are done with step one and step two, preventing application for deployment. Now we'll publish our folder and codebase to GitHub. So in order to do that, I have created an empty repository in GitHub desktop, and I've moved all my code Windows desktop folder. Now I'm just cannot push it took a tub. So the way I'll do it as I navigate to my test bed actually, and I'm already dead. And we'll just do a git, add. Git commit. And message will be adding fires. And then get Bergosh. Mean SME for us, word it, give it that. And yet VR all good there. So I'll just do a refresh and I'll be able to see my object file here. So we have our prop file, which looks good. We have our requirements file, which also looks gourd. We are front. X-bar looks scored. Setup got SSH file, looks good, and desktop dot PUF looks good. So there are multiple, multiple ways in which you can push your code to GitHub. One is like kissing the interface that get up provides you can just click on Add files and upload files or create new fights or in other ways using the command prompt. The way I did. So, yeah, he has done with step 3 as well. And the main step, the most important step is remaining null, which is deploying. So we'll talk about it and the next video. See you.
5. Video 5 Deploying to Heroku: Hi everyone again. So we have, we are, we are done with step 1, 2, 3. And the most important step to deploying the website is now remaining, and we'll just see how to do that. So we'll use something called as heroku to do that. And I'll just sign out and sign in again and just show you what heroku is all about. So Heroku was actually a company that is now part of Salesforce. It basically helps deploy things on Cloud. Of course the charge for it. But I'm a big newer user like can just log in or create an account and just installed or deploy five applications free of cost. Although there are limited functionality, but even the free version is like quite good. So feel free to fill these details and create a free account. There will be no charges for credit card, your own African give you a credit card or something else. So once you do that, you can login to Heroku. And when you, when you login to Heroku is something this is what you get. Now, I already have created this, these free apps. So what I'll do is I'll press on name. And then here we have to press on create new app. Once we do that, it will ask us our app name. So let's try and see if desktop is available or not. It seems that it should only contain lowercase letters and numbers and dashes. So of course, this is underscore one book, so maybe just try this. Yeah, this, this name is not available. Test upstream. Let's, let's try this. And this is also not available. Let's try this. So yeah, this is available desktop streamed live demo so you can choose any name you want. Just make sure that it is available. You can choose one of the regions to whichever regions here close to selecting United States will not press on Add to pipe in battle. It's centered once, whichever we talk about it in later, later courses. You press on Create app. And when, when you do that, it will ask you a ton of answer, What's the deployment method and so on and so forth. So you have the skip this part, the pipeline, but you have to directly come to deployment method. Now, what do you have to do is we have three options to deploy on Heroku. One is using headed to Heroku git, which is nothing but the command line functionalities on kit. You can directly push your folders from there to get up. Another is using GitHub and another is using Container Registry. Again, command line-based tool. We're just going to focusing on using GitHub. So when you press on GitHub, what it will do is it will prompt you to login your using a GitHub account and then it will directly connect to our GitHub account. Then what you can do is you can search which repre you have to deploy. So I have already connected to connect it to my account. And the rep that have to select as basically this rep, oh, sorry, this repo which is test app. And so I'll just write desktop and press on search and I hope it finds the report. Oh yeah, it finds the rebel. And what I'll do is I'll just press on Connect. So it says connected to this repo and it will just social information if you want to check about different releases and so on and so forth, you can select a brand to deploy. I just have a main branch where no other branch, but you can choose any branch. And I'll click on Enable Automatic deploys. So what it does is basically whenever you push a code to your GitHub repo, it automatically, I'll, will redeploy our application again. So for example, if I make changes to my stream that app, I'm sorry. Yeah, if I make changes to my stream that up here, anything and I push it to GitHub with updated code. This will automatically deploy my updated app and we'll update my app in real time. So this is really useful feature. So I generally do automatic deploy in case you don't want to don't want that to happen, you can always disable MN. Yeah, I mean, you can deploy a branch manually as well. So I'll select the main branch and click on Deploy. So what it's going to do is basically it's going to build your code. And you can see the logs here. It's installing Python 3.6.13 version, which is basically what we mentioned in the runtime dot TXT text. And then it will install all the requirements for STM lead. And basically it reread your requirements file and it'll install everything, right? So once that is done, it generally takes some time to build your branch or your cold, about two to three minutes depending on how bulky and how complex it as if you're using many Packet residue will take time to install. But a basic installation is done. It essentially creates a virtual computer for you somewhere in the Cloud. And then it's installing Python and, and although all the dependencies that it needs a, once it does that, it'll just give you a message saying that deployment successful. So let's just wait for that message. So yeah, just wanted to add one thing. It says compression done 139 MB. There's a limit to any application which is 500 MB in the free version of Heroku. So you can't really deploy any application greater than 500 MB. But if your application mostly contains text adding, you're going to be fine. All right, so it sees released V3 and you can use this two. It says your app has been deployed at this URL using Heroku. And we are good. It says you're up for successfully deployed. Now if you want to view your app, you just have to click on View button. This is your folder where you have to basically, you can see your application. All right, so this is now the updated version. You can change the theme of your application from head against, choose a light theme. You can choose a dark theme. You can, you can play around with this. All right, so this was a quick demo on how to deploy an application using stream net on web. And this, this link is something that you can share with your friends, anyone else? So, all right, Thanks so much.