How to Deploy Django Project on Heroku for Free | Step by Step Tutorial by Code Band

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey you this is Jassim from cold band and in this video I'm gonna be showing you how to deploy a django application to Heroku so if you're new to my channel please do subscribe my channel and click the mail icon near to it so without any further let's jump right into it [Music] all right guys so what I have prepared is you know a documentation on how to do all those stuff step by step instructions and the link for this repository I am provide in the description section so you can follow along now I'll start off with the first step that is if you don't have git installed on your system then follow this tutorial right in here and come back here now this tutorial is in a git installing a tutorial where you could download it if you're using Mac or Windows or something you hope you have all those tutorials here now if you're using in case you're using Windows then you could easily download get for Windows installer and you just have to set these in your CMD and with that being said do all those steps and come back in here in our git repository and the next step is make a fresh copy of your project or is a separate git branch now if you're very familiar with git and it's working then I absolutely recommend you to do this way use a separate git branch and it could name something like Heroku and all and do those stuffs there but if you're not that familiar with git then this is the way to go make a first copy of your project now I'm going along this way because many people may not be comfortable with this one so I will follow along this way I just make a first copy of my project in here I have created a to-do project and this one has a virtual environment and you know this is our core application the to do application and with that being said now the whole application the whole application is nothing but simple to do where it could add something like this and it could update those in here if we click update you can update then you could delete and this is all about the application so make sure you created a new project new fresh copy of your project and after that the third step is make sure virtual environment a is activated meaning you know I just closed the server now my virtual environment is activated and it's up and running it has all the dependencies like Django and Django crispy forms in my case in your case if you just beep phrase then you'll find all those dependencies and make sure you have those dependencies right there now after that now this is the next step add your dependencies to requirement stuff txt you just type in this command and it will automatically are add these stuffs into requirements don't txt file now make sure you are in this directory in this to do directory and show you in this directory make sure you're in this directory and proceed with that command trip trees then the greater than symbol and with commenced or txt then now will you get a file a text file which have all those dependencies now with that being said move to next step add this insulin stored py so I'll add this one in the setting store py now what I'm doing is I'm opening my project in PyCharm now you could use any editor or you could simply go to the to do and you know you could edit right in here but I will do you know it in Python so my Python in here I will just open my project I just copied this path right here and I'll paste it in here and I'll just open this directory now with that being said I could possibly edit the setting start py file I've just closed this one now I'll go to the to do and in settings toward py file and this file right here I just add that static route what I have copied from there sorry not this one this one so you could just you know copy and paste those stuff here and the next step is make a Heroku account now here we are using Heroku as our hosting provider Heroku is a very simple pass like platform as a service provider and it's very easy to host in there and it's absolutely free so you could do it what you could do is click on this link and create a new account if you already have if you already I don't have an account so he's just click in here and you just do the signup steps my internet connection is a bit slow here so it'll take a bit time so I'm not you know talk about that I'll just you know continue here after signing up for an account you have to come over here download Heroku CLI meaning it just click in here you know that there is nothing like Heroku command-line interface so you can you know talk to Heroku with just your CMD itself so in here if you go down then you have this installers if there's a Mac or Windows you can download and the Appropriations and after installing is just come back in here then what you have to do is configure Jango Heroku now this is a separate tutorial of the Heroku documentation that they provides us for deploying django application so I'll click on that and in here we have some some steps so the first one is creating a proc file now in order to create a file like that what I have to do is come back in here in my project and in my project root directory I just create a new file so I'll just right click and create a new file now I will name this as the same name in here this one proc file now I'll click enter now remember that this doesn't have any extensions like dot txt and all if you have you know those extension this won't work the process won't work so make sure it doesn't have any extensions now in here is scope in this stuff this web's unique on project though WSGI is copy-paste this one now this is nothing but you know to make sure Heroku hits your application in the profile they'll start in the application from this file the WSJ file now the WSJ file is in here in the to do we have this WSJ file but you know this part is incorrect as it's in the documentation what you have to provide is in a district tree where we have this WSGI dot py so just make sure you you know correct this to do now in your case you just rename this to whatever your folder name that holds this WSU dot P one so with that being said the next step is Pippin soul-g unicorn is type in your terminal here in your terminal just type in pip install G unicorn and click enter and you know it'll install G unicorn and you know be sure to add unicorn to recommenced or txt so I'll just do this statement here pip freeze a requirement store txt and then it will add that unicorn and the next one is you know your pip install Django Heroku you know this one is related to the database tips and all it will automatically you know use that information in your application so again make sure you just add it to requirements table txt so I'll do this stuff here and that's it now in the settings or py add this import to your top of your settings or py so I'll just copy this one I'll come in here in the settings toward py I will add this in the top in both Django Heroku now the next thing you have to do is you know at the bottom of settings toward py copy all these steps in here so I'll come back to the bottom and I will just say you know this one this stuff okay so with that being said now what I have to do is you know come back to my github repository so with that being said now the next step is this one in your terminal type in all these steps like I'll showered get in it now this is nothing but to make sure that you are you know you your project is a github repository now I'll make get in it now the next step is get add dot like in here you could see now the next one is git commit minus M so I'll just copy and paste those stuff and the next one is Heroku Logan now if I type in Heroku here you know I have those things ii-i'll get something like this one now if you are getting something like you know the Heroku isn't recognized as a command you just have to you know close your terminal and reopen it so that's the method to fix that now I'll just type in this one Heroku Logan and I will just you know type in their Heroku Logan in which we which logs me into the Heroku account which you have created right now I'll just any key here I'll just press any key which will pops out a browser I'll click in the log in here and I have logged in successfully so you know it will take effect in this terminal as well now the next step is Heroku create app name now the app name is nothing but your application name and you know whatever you provide here will in act as your subdomain like if I provide test as my app name now test dot Heroku app comm will be your URL so make sure you do in that sense so I'll just copy this one and I will paste in the terminal and I'm just you know name this has a code band called band Jango for instance and with that being said Heroku will create an application for me now we have that application up and running and the next step is you know you have to just do git push Heroku master here so I'll copy and paste those stuff and if you are using this you know this method like if you're using separate git branch now this method will be different like you have to push from your Heroku branch to the master branch in the Heroku so this is the method if you're doing you know in this manner if you're using a separate git branch otherwise if you're following me you could just do git push Heroku master now with that being said it will push all the contents in our local repository to the remote Heroku repository now with that being said all you have to do is follow this command Heroku open click in there and you just paste in here which will open your project in this URL in this year probably and it will pops out in your browser and here and you'll find an error which is nothing but you you have in migrated your stuff in in the remote database in the in the protection a server so all you have to do is come back in here you just do this one this command here you know paste it in your terminal just painted it and just paste it in I'll just copy and paste and with that being said you know that the migrate command is being running the Heroku remote server and it just done all those migrations now if i refresh the page again I will get that application live on the server so if anyone with this URL can access your life project now I can add called ban here which will be shown submitting will save in those in the remote database and I can update it I can delete it and all the functionality is working perfectly now if I update it I go the same exact result I can now delete this stuff and everything is working perfectly now one thing to note is in the remote Heroku they are giving you a free PostgreSQL database which you could in of course modify to mysql or something which is on the hero 2 site that it could you know possibly research on that and with that being said now that the last thing you have to do is in here you know you have to set debug is equal to false and which is because of if I go to a URL that doesn't just like this one then it will show that a default django page which will expose all our urls now this is not good as this isn't in the live protection mode and so you could possibly do is you know set your debug to false now if you do any edits on the project in order to become it live on the server all you have to do is you know follow these three commands and which will make those things like so and just get add note I'll just copy all these are whole steps and paste it in my command prompt then I'll click enter and which will essentially you know bring all those changes live into the server so with that being said everything is deployed and now if I do a refresh on this page again now it will show the this chatted for not for page so this is all about it this is all about deploying a project at younger project to Heroku it's very simple and very straightforward now if you have any doubts or if you fall into some errors during the process please let me know in the comment section so I can help you so with that being said if you haven't subscribed to my channel please do subscribe to my channel and click the bell icon near to it so thank you for watching we'll see you in the next one [Music]
Info
Channel: Code Band
Views: 23,499
Rating: undefined out of 5
Keywords: how to deploy django project on server, how to deploy django app on heroku, how to deploy django application on heroku, how to deploy django project for free, how to deploy django project on linux server, how to deploy django project on apache server, how to deploy django project on github, how to deploy django project on aws, how to deploy django project on pythonanywhere, how to deploy django project on google cloud, deploy django app on heroku, deploy django website on heroku
Id: V2rWvStauak
Channel Id: undefined
Length: 14min 51sec (891 seconds)
Published: Wed Apr 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.