How To Deploy A Django Project To Heroku

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys welcome to my channel in this video i'm going to be showing you how to deploy a jungle app to your roku so if you're a jungle developer and you've tried to deploy your django project online before you know that deploying django project is not that easy it's quite stressful with the problems of static files and some bugs you might encounter but in this video i'm going to walk you through the steps to be problem-free hosting your django project so the first thing you need to do is um to install some python libraries so right here i have a jungle project i just created actually there's nothing on it it's just called my site so let me just run it and show you so i'm just going to run the django pressure i just did now i'm going to show you so we're going to host it with iroku so the first thing we need to do is to install some libraries which are gunny con and django heroku so let me first show you guys it's just an empty project so as you guys can see this is what is showing in store work successfully it's just showing a new jungle project so let's get back here and quit so what we want to do now is to host that onto roku so the first thing we need to do is to type peep install gunny con and jungle iroku now these two libraries are very essential when deploying your projects to roku so they are going to go ahead and install i already have them installed that's why it says requirement already satisfied but for you you should go ahead and install that so what we need to do now is to come to our roots directory and then create a new file and name it runtime dot txt so right here what is going to be in this file is the python projecting which you are using for this jungle project so to get your the python version i mean to get your python version you are going to say python to iphone's version now as you can see it says python 3.7.4 so we're going to come here and type python iphone 3.7.4 and save that that's good now the next thing we need to do is to create another file in a root directory now i'm going to name this one proc file this is not going to have any extension just a normal file named proc file as you can see visual studio code already identifies that file so what's going to go in here is a line of code it's going to be web unicorn and we're going to put the name of our project right here my site so in this my site it should be the name of the project you are working on that wsgi column application iphone log iphone file space iphone now this is how this file should look like this is what it should contain so i think that's good let's just go ahead and then quit close this file now that we have those files created the next thing we need to do is to get all the libraries used in our python project in our jungle project so now to get that we're going to beep freeze greater than requirement dot txt now what this command line is going to do is going to create a new file called requirement.txt in our root directory and then it's going that file is going to contain all the libraries we use in this project now as you can see it has a new file named requirement.txc so all the libraries used in this project is what is going to be contained here so as you can see we have django roku unicorn and some other things along with their versions so now that's good the next thing we need to do is to go to our settings file settings.py so up here right here what i just need to do is to import jungle underscore heroku and then import dj database url now after doing this we're going to scroll down all the way to the bottom and i must say that to avoid any error in your static files because hosting on jungle deploying a jungle project there is always errors with the static file just add this code below so i don't know how you've configured your statistics file because different django developers configure their static files with different code but if you use this code i just pasted in here you won't have any problem so after that we can just type django heroku does settings open bracket locales then open bracket close bracket now after doing this we're going to scroll all the way up and then we're going to look for the an empty list called allowed boost now as you can see this is an empty list now this list is going to contain um the host which can open your project now when we host this on the web if we leave this empty any domain in which we use let's say our domain is mysize.com once we go there it's not going to open this up project because we didn't specify that we want my site.com to open now if you only want let's say mysites.com.com to open this your project will do it like this now only mysites.com will open your project so if you host this your project and get another domain let's say that site.com that domain is not going to open this your project because we've only specified that this is the domain we want now sometimes this is to avoid let's say attack on the website or just to secure your website but if you want any domain to open your website when you use to open it if you want it to be universal you just type asterick right here so once we give it a steric that means any domain can open and i think that's more recommended because you might want to use different domain or subdomains for your website now after doing these we can just save these our settings file and then come down here to our terminal so i must say that for you to be able to use iroku you need to download iroku command line interface now if you go to your terminal and type iroku you should see some results it should print out some results they have to show that you have heroku command line interface installed as you can see it shows out some things if you type in iroku and it says this isn't recommended this isn't um seen as like a command or something like that or it gives you an error that means you don't have your roku command line interface installed so for you to install these you can just go to the web and search download iroku cli now once you search this all you just need to do is to click on the first link you see from devcenter.com and then after doing this you're going to see um a list yeah so right down here scroll down and then try look for the one that suits your operating system so as i'm on the windows if you're on a 64-bit or this two-bit click on it and it will go ahead and download that then install it and after doing that you need one more thing you need git to be installed so for you to install git you can just type download git for windows i'm on windows so if you're on a mac you say download git for mac so when i say download git for windows and i just come here click on this automatically it's going to start downloading it so once you click on click here to download manually it's going to start downloading it so now we can quit that so after doing that and installing it i think we are good to go so and also if you type git you should see a response if you see an error then it's not installed so i hope that is clear so after doing this you should make sure that you have an eroku account so if you don't just go to roku.com and sign up for an account then after you have an account you can come back to your terminal and type your roku login now this heroku login is going to prompt us to open our default browser and then login so what it wants us to do is press any key to open the browser or queue to exist so if you press any key apart from q it's going to open your default browser and log you in but we press q it's just going to terminate the command so let's just press something else now it's going to open chrome because that's my default browser and once you open that it's automatically going to create a new tab and go to the authentication page so now when i click on login you see it says logged in you can close this page and return to your command line interface it should now be logged in so let's go back as you can see it says done logged in as my email that's good now the next thing to do is to create a new app on iroku you say heroku create let's do something like if we type my site i'm pretty sure that someone else has created an iroquois app near my site so we need to type something unique so let's just say um hero creates my okay i'm just gonna just give you something my siri app yeah let's just give it a random name but if you don't know what to type you can just type your roku create without adding any field is automatically going to generate a unique name for you but it might be jargons so let's wait for this to create okay so it has automatically created that now the next thing we need to do is to just type git status okay it says there's no repository so what we need to do is to say git init now it's going to initialize the repository here and then we can type git status again and now you see that it sees a repository now the next thing we need to do is to type git remote iphone v and then now we can say git remote add iroku i mean we're going to scroll up i think that should be right here i'm going to copy this so now scroll down and then paste it now that's good so now let's type gate remote v now you see it gives us a response and then we just add these status again nice so the next thing we need to do is to basically just say git add then a full stop now this is going to add all our project all the files on our project into that repository i'm going to press enter and then wait for it to do okay so after that we say git commit m then can say the first time okay nice now the last step is just to say git push iroku master i'm and it's working so that's how to use the jungle up so this is what the profile should look like and that's it thank you so much for watching this video if you enjoyed it please smash the like button and please subscribe and turn on the bell notification button so you get notified when i drop new videos having that said thank you for watching and bye for now
Info
Channel: Code With Tomi
Views: 46,576
Rating: undefined out of 5
Keywords: heroku, django, python, deploy, deploy django, deploy to heroku, django project
Id: XZoTukqekzY
Channel Id: undefined
Length: 14min 1sec (841 seconds)
Published: Thu Dec 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.