Django web app deployment in google cloud app engine(GAE)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys how it's going today i'll show you how you can deploy your xango base project in google app engine google cloud platform give you 300 free for 12 month which is enough for your initial pulling around so first of all uh you guys have to register for the google cloud platform i have already registered it you need a working credit card and a gmail account and you are done for that google provide a very good uh documentation for deploying of your tango project in app engine and even after that i wish a lot of difficulty so i prepared this video so that you guys do not have to go through same difficulty so let's start now let's go toward the documentation of the google app app engine provided by uh google cloud the link is provided in the description you guys can check the description uh the documentation before going through the whole procedure uh please uh remember to register for that before going through all that uh all this process uh you can quickly read all of this before going to the processor uh you can go to register by clicking on that console button so let's start let's begin so first thing is to select a project if we haven't uh created a project then we have to create a project first you can create a project by go to select project and then new project now let's uh select our project name for me i think youtube tango block is okay and let's hit create it will take some time for the project to be created let's just create yeah the project is created so this is my project as we can see the project name and project id over there and let's return back to the documentation again the next thing which we have to do is to follow the cloud.sql.admin we have to enable that just click that button and follow the link okay let's select our project which is youtube. xango.block and hit the button yeah we are done with that also the next step we have to install and initialize sdk you guys can follow that link from some other place uh now let's login our account please install sdk first you can you guys can follow that from some other place uh let me just login to my google cloud from the directory where my project is stored and i select my account in which i have google cloud so the authentication process is done yeah now let me initialize the z cloud in this present store please install zcloud sdk before it let me just follow the link reinitialize the project uh let me select the account my account in which my project is good and my project name and yeah i'm almost done okay yeah that initialization part is also done after initializing process let's clone let's enable our sql admin quest and we'll clone our project yeah that is done now let me download the proxy i'm just following these steps that is the proxy if you guys are on other environment please uh download or do the steps accordingly we need the cloud sql proxy so that we can access our database from our local coast also it will just take some time uh now i'll copy that exe file of the proxy to my working directory and i'll remain rename it so that it will be easier for me cloud sql proxy would be very easy for me now uh we have to create instance in our gcloud so please click that button and follow the step you should be i am admin that means admin so for creating instance you just have to follow that link i'll be creating an instance first and the instance would be of mysql not postgres now let's give a name to our sql instance for me blog instance is okay and also give the password and also select the area where we want to like uh store that and let's hit create it will take some time to create a and here it is our instance is created inside this instance we will be creating our database after this let's okay what is the next step okay let's uh see let's enable our let's see what is our connection name because we'll be needing connection name in order to connect for that you can just copy that line and give your instance name for me it's blog instance okay let me write blog instance and hit enter okay it's a bit easier okay the connection name should be somewhere over there it's easy it's not that difficult to remember also so let's uh write another line in order to see whether we can make connection or not if the connection is made then we'll be assured so let's open uh open the command terminal where our cloud sql proxy is located and let me just copy that line over there and just put the connection name over there copy and like paste yeah okay let's hit enter uh let me just take some yeah okay so we are able to communicate with our google our blog instance so we if we create a database inside that then we can communicate with that the next step would be to uh create a database inside this instance uh for me um i would just like to create a database by going to that database button and keep a general name like youtube log tv or something like that easy easy pc not that difficult okay and then hit create so the database is created we also uh it is a good practice to create another user also let's go and create another user i can go inside the user section and then create another user root user is there but it's good to create another user also i'll give the general name which is admin and then keep my password and the it should be access any host should be able to access it of course please take care of that okay the username is also created now let's uh see what the connection is actually okay yeah so let's go to our uh documentation again so this is that now we have to configure our database setting and everything is provided over there and even the setting for the documentation a database is provided over there at the last section please copy that section and go to your project xango project inside settings so if you guys do not have a project this is also a time where you can like download a project from github or even the samples is provided over there please copy it and just go to the settings section and try to uh like edit everything from connection name which you can find it by going uh in your command terminal just like before okay let me just see okay function is actually here what i'm searching for yeah okay just put the connection name over there and my username which i have just created which is admin and password for hiding my password i have set my uh that password to os environment for you guys you guys can write your password please do not write os environment when you deploy deploy your project to google cloud it won't be able it will not be able to understand then let's give my database name which is block.instance now let's also add it to another section which is like local host and the username is admin and the password similar to a pop os environment i have set my password to my environment variable so i can access for you guys you can directly write your password so yeah everything is done over here so let me go to the command terminal and let me yeah of course uh the next thing is we also need to install this by mysql package which i haven't installed so let's install that first yeah it's installed please do not forget to install this package and i have also provided a line which will be needed just off of your database so your django database could easily communicate let me check inside the requirement.txt okay it's there over there so let me put those line these lines are provided in the description you guys can just copy it and paste it in your settings dot py it is needed for your database to communicate with django now let's check what are the other steps which i have to perform okay so the the configuration of the database is almost done over here then the next thing is to run our app and we i think you guys must be familiar how to run a django project so we have to first of all perform the migrations and then migrate so if you haven't if you don't have the virtual environment please create that it will be a lot easier and if you have downloaded your project from git you guys need to have your virtual environment of course i already have everything set so i can directly go for okay there is some issue oh i haven't uh start my proxy so we checked it last time so we have to start our proxy please do that in another command terminal so okay let's try again so the connection is done over there we can see blink again what isn't the issue now okay okay okay okay okay instead of the instead of my database name i wrote my instance name so i have to go over there and write my database name not the instance name guys please take care of that don't repeat the mistake i have just i have just committed go over there and write your database name not your instance name and i think i should be able to be i am having a good feeling now yeah it worked so again let's uh make migration our other apps for me it's blog and users so let me do that yeah so everything is done now i can migrate so all these database are created not locally like when we initially test our project but it is stored in our google uh cloud which is going through that proxy which is communicating via that proxy so all this database uh all these data migrations is performed in the cloud itself so all those tables are created right now in the cloud so now i have to create super user of course okay that is my deposit name yeah just give any common name it's okay my password again yeah i'm done now i'm done i'm ready to uh run my server yeah guys mind it it will be a bit slower when you have your database in the cloud then locally so yeah i am able to go to my project i think yeah okay okay i'm ready i am able to get my project let me create another username so i can demonstrate it to you guys like how everything is done over there again password yeah let's sign up yeah it's working okay everything is working fine here also everything is fine you can also see uh the connection made by my local app to cloud everything is fine over here let's go to my project now so locally it's running fine uh as and the database is in the cloud let's uh deploy this this project to the app engine now so before deployment we have to uh false our debug you have to false your debug there is a easier command which i have i will write in the description like for this it will be false when we are in google app engine application so now i'm allowing the all host if you guys don't want to do that uh like you can go to your project and find ip it should be in uh your database where your database is located you can just write your ip and keep the access for me it's fine it's just for demonstration purpose so i uh wrote it astric over there which means to allow all the host to communicate with that the next thing which you have to do which we have to do is to just provide the static route and comment that static validir which will create some issue and the database is fine over there okay next step is you have to collect your static files uh for that manage that by collecting staticity okay and after this you guys are ready to perform your deployment and the code is gcloud app deploy hit enter oh my god i forgot something okay app.yaml file i haven't created app.yml file i'm so sorry guys uh you guys also have to create a uh app.yaml file without that we cannot deploy the project the code for the app.yml is written in our documentation at the end you guys can just copy it and we have to add one more line that is to give location of our ws west key file i've already written that code let me just go and copy paste it so this is the way this is the location which where i have to write it over here let me just copy that line and paste it okay for you guys there should be your project name my project name is dango blog project so instead of that you guys can create your name and also remember the kunigan should be there without gunigan if we deploy our project it won't work so requirement requirements.txt is a must if we do not add that then the app engine won't uh be able to understand like what kind of package is our project used so requirement.txt is a must and inside that you must put gunigan uh version gunigan package so let's deploy now same command google app deploy it's working now let me deploy it in central us 14 it will take some time guys you just wait patiently it could take a lot of time actually if you have slow internet connection so okay the process is as i started now yeah i'll just fast forward it now yeah okay it's done you can also check the lock from uh the first command and if you directly want to see how your project is deployed and you can just type gcloud app browse or you can also check the link over there copy it and paste it in our in your browser okay okay so i can see my website is this it is being hosted in google cloud app engine and guys please remember to uh write your password instead of os 30 environment because app engine won't be able to understand that so okay let me just log in to one of my account which i previously created yeah i am able to login since the inside the sql i have already created that so it's working fine so this is the project and this is my code which has been already transferred to gcloud base so yeah so almost done everything is finished now so you guys can also try it deploy it and i'll catch you later thank you you
Info
Channel: Andromeda
Views: 3,420
Rating: undefined out of 5
Keywords: Django, google cloud, app engine, serverless, django python, deploy, gcloud, google app engine, python web app, django webframework deployment, website deployment on gcp, Deploy django website, python django in gcloud, python django in gcloud app engine
Id: h243bLNpLxs
Channel Id: undefined
Length: 26min 15sec (1575 seconds)
Published: Sat Aug 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.