Detailed Notes
We wrap up our UAT fixes and start to look at gathering source and data for our move to production in the next episode.
You can view source for today and all prior days by reviewing the code at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial
Transcript Text
[Music] hello and welcome back we are going to work on actually sending our site that we've been working on put our application out on a uh we'll call it a production server hopefully you have one set up and we're going to walk through it some of this little some things we've talked about before but and we'll get ourselves started here and get into uh in this case what we're gonna do is we're gonna have the django server and it's going to be front-ended by an apache server and we're gonna clean up a couple of things that we have set for us at this point to give us our development version of the django server the first thing we're going to do as mentioned before we're going to go over and we're going to grab our code so i'm going to grab my code here and i'm going to do a get clone with that that link and so now i'll see if you saw some over here uh it opened up alright created here's my project and so i can go in there and let's see what happens now the first thing i'm going to do if i try to run it is it's probably going to fall apart so here because i've got i'm missing probably a module here so although i've got python set up i do not have everything else set up and so what i'm going to need to do is i'm going to have to actually go through and make sure that i have my use pip3 or pip i guess you know pip3 in my case and make sure that we've got everything straightened out so let's go look at our this one real quick so manage uh if it goes to line 22 let's see what it says this may point us in the right direction uh man so it's probably os and cis let's just check those real quick and this and so it is complaining about our base command so let's see let's go look at so we're at three five so we should be okay but we probably need to upgrade it so let's go ahead and in this case we may have to do an update so we're going to go ahead and check that first one so let's go ahead and uh so whoop down update [Music] oop this is going to be probably apt-get so we'll go ahead and update this and then we're going to have to do let's do python 3.7 i think is how it goes okay we're going to actually change this over because i don't like how it's referring to now let's try this there we go okay so now we're going to have some issues with getting our database together probably so let's go look here uh where's our installed apps that's all good databases we don't need our test at all and then this one we're going to have to actually create a user so we're going to call it um dev user well i'll get rid of the underscore and we'll give it a password of uh we'll give it basically the same thing we're just going to change it up a little bit and so now what we need to do is we're going to actually create that user so we want to do is we want to jump into my sql and we need to do create user uh we're gonna call it dev user and uh we're gonna just paste this in and we're gonna change this around a little bit because i stole this because i always forget the exact thing so this is going to be create user i'm sorry tab user at localhost and it's going to be identified by i'm going to give it the password come down here give it the password and i'm going to do the same thing and do it with a wild card just because because that sometimes can be an issue so now i've got that created and then i need to grant all on star 2 this guy oh i'm not a um i need to be roots so let's do that oh i think i can do it this way and now if i do grant oh let's start out star two there we go [Music] percent cross privileges if i can spell it right okay so now let's go back out here so um bring in our database we already looked at that you can create a database source pull that in and i've actually done that here so now if i do let's make sure i can see it so if i do dev user p password is oh paste it here okay so i can do show databases and i can see dp project okay so good so i'm able to use it and so i can quit now now let's go back and try to run and oh did i oh i forgot to save that and so now it's running so let's go see if okay so i'm not getting that and if i look here it's not getting through here at all so what i need to do is open it up oh it has a lot of hosts is wide open so let's try to do this let's actually run it on there and now let's see what we get okay so now we are coming through log in so i'm able to see this i don't care to save that um oh i guess i can blow this up a little bit so we can see a little bit more and so if we go to our goals there's nothing there if we look at our roadmaps but we've got it because we've pulled all our data in and we're now running off of our other server and we can see here from our debug stuff that we now have our server running on our our demo our dev server running on the other side so now let's start cleaning some stuff up so we don't want to run with debug turned on on production we're going to change our secret key at some point but we'll just right now not worry about it too much so we have all of that and now if we run we should get the same thing we should still be able to run wow everything's complete there let's pick some that are different oh wow that was interesting that one just totally blew up on us so what we're going to run into probably oh because this is now it's picking it up that it's production we're going to find an error here i think because if we take that same one let's go back to debug equals true so it's here and we're gonna see if it's false and it's gonna blow up on us i think well when it tries to reload i'll shoot okay let's do this oh maybe it's not going to blow up on us okay all right well typically what happens is it's going to end up because it's going to the wrong static as we start to turn stuff on so let's go to here and what we have now is we have it actually running our application we've got our database set up we've got our password all of our blah blah blah blah blah it's really not much else we have to do except we're going to deal with this static and you're going to see right here we'll go ahead and use their little documentation and we're going to see that here let's see that's during development serving files testing deployment uh so here we go so we're going to have a static route for getting to our server so instead of putting all them here we're going to actually put them out on our site somewhere and of course we're going to do is copy all of our files from our static into our static route and so here let's create oh i'm just going to take a let's stop this and so now what we want to do is we're going to go to our website and we're going to make their uh we need to do a pseudo and we're going to call it dp static and if you'll see here we don't want it owned by root we want it owned by wwe data so we're going to do sudo r just to make sure we get anything underneath i do that for dp static and so now it's good now if we go to see there now what we want to do is we need to copy everything that is here we need to copy this static over to the other static so what we want to do what we want to do is we want to pull our static files over so we're going to go here to our um where did that go go here oh one more level up and we're just gonna do tar uh put it back here static star oh we gotta call it static.tar that uh let's not do that we won't actually go up one more because we're going to do it so that it'll come from here and now we want to do tar whoops till the whoop come here till the slash static tar star oh and it's going to be a cvf my mistake okay so there we go so now we can go here and go back to our static on our web and then we're going to do a tar dash xvf our static files here so now they're all here and so now if we look we should be able to do see demo one dp static so let's make sure that that actually gives us something and we can see here that we've got our folders so which is this is not a production server normally you wouldn't be able to see that so now if we do that and we're now going to go back to our application i guess this path yes this path and we're gonna go kick this guy off and let's see what he does for us uh where we go here we go and so now uh let's get rid of that for right now let's get rid of that for right now and we're going to see here let's go to like a task list here and if we look into our developer tools we're going to see uh sources and we're going to see that here we go like dp static css it's pulling that up so now we did see that it didn't like jquery so dp statics js jquery didn't we not have that let's see if we go to static js now somehow that got moved so let's uh let's see so is that jquery mint whoops let's just check that real quick so he was trying to find jquery.js and bootstrap bundle men so let's go check those guys real quick bootstrap bundle man.js should be there so let's go check our website real quick go to js so he should see bootstrap dash bundle dot i'm going to give you the full path uh whoops let's go check that real quick uh dp static js bootstrap dash bundle dot men bundle dot man dot js not finding it and so let's go back and look for that oh bootstrap.bundle so let's just copy that bundle dot min dot js2 bootstrap dash bundle dot min dot js and then we're going to also copy the jquery to i think we just called it jquery.js and so now if we go look non js module files so we just blew something up pretty heavily there let's go look here oh because our server's down so let's go back over here oops i think that's it let's run our server where'd he go there we go okay so now if we look at our console good we got our stuff and things are showing up there we go okay so now we've got and like i said if we look at our sources we're going to see that we're coming off of static so we've got our static stuff coming through and so now what we're going to do is we're going to actually front the next thing we're going to do is we're actually front the the servers so we're not going to be using this anymore we're going to actually be able to come through and that is going to be in the next episode and once we've got that then we will be off and running we'll be able to redirect we can use our you know dns's namespace and we can actually redirect and we're also going to do our https connection since if you haven't noticed we have been unsecure and if we do this it's going to blow up on me see i can't get there because i can't do i provide a secure connection so we're going to get all that stuff straightened out next time so that's something to look forward in what will probably be a part two in our final episode in this series on django and python we'll catch that next time but until then have yourself a great day and we will wrap it up next time you
Transcript Segments
[Music]
hello and welcome back
we are going to work on actually sending
our site
that we've been working on put our
application out on a uh we'll call it a
production server
hopefully you have one set up
and we're going to walk through it some
of this little some things we've talked
about before but and we'll get ourselves
started here
and get into uh in this case what we're
gonna do is we're gonna have the
django server and it's going to be
front-ended by an apache server
and we're gonna clean up a couple of
things that we have set for us at this
point
to give us our development version of
the django server
the first thing we're going to do as
mentioned before we're going to go over
and we're going to grab our code
so i'm going to grab my code here
and i'm going to do a get clone
with that that link
and so now i'll see if you saw some over
here
uh it opened up alright created here's
my project
and so i can go in there and let's see
what happens now the first thing i'm
going to do
if i try to run it is it's probably
going to
fall apart
so here because i've got
i'm missing probably a module here
so although i've got python set up i do
not have everything else set up
and so what i'm going to need to do is
i'm going to have to actually go through
and make sure that i have my use pip3 or
pip i guess you know pip3 in my case
and make sure that we've got everything
straightened out so let's go look at our
this one real quick so manage
uh if it goes to
line 22 let's see what it says this may
point us in the right direction
uh man so it's probably os and cis let's
just
check those real quick
and this
and so it is complaining about our base
command so let's see let's go look at
so we're at three five
so we should be okay
but we probably need to upgrade it so
let's go ahead and in this case we may
have to do an update
so we're going to go ahead and check
that first one
so let's go ahead and uh so whoop
down update
[Music]
oop this is going to be probably apt-get
so we'll go ahead and update this and
then we're going to have to do
let's do python 3.7 i think is how it
goes
okay we're going to actually change this
over because i don't like how it's
referring to
now let's try this
there we go okay so now we're going to
have some issues with getting our
database together
probably
so let's go look here uh where's our
installed apps that's all
good databases we don't need our test at
all
and then this one we're going to have to
actually create
a user so we're going to call it um
dev user well i'll get rid of the
underscore and we'll give it a password
of uh we'll give it basically the same
thing we're just going to change it up
a little bit
and so now what we need to do is we're
going to actually create that user
so we want to do is we want to jump into
my sql
and we need to do create user uh we're
gonna call it dev user
and uh we're gonna just paste this in
and we're gonna change this around a
little bit because i stole this because
i
always forget the exact thing so this is
going to be
create user i'm sorry tab user
at localhost and it's going to be
identified by
i'm going to give it the password
come down here give it the password
and i'm going to do the same thing and
do it with a wild card just because
because that sometimes can be an issue
so now i've got that created
and then i need to grant all on
star 2
this guy
oh i'm not a um
i need to be roots so let's do that
oh i think i can do it this way
and now if i do grant oh
let's start out star
two there we go
[Music]
percent
cross privileges
if i can spell it right
okay so now let's go back out here
so um bring in our database we already
looked at that you can create a database
source pull that in and i've actually
done that here
so now if i do let's make sure i can see
it so if i do dev user
p password is
oh paste it here
okay so i can do show databases
and i can see dp project
okay so good so i'm able to use it and
so
i can quit now now let's go back and try
to run
and oh did i oh i forgot to save that
and so now it's running so let's go see
if
okay so i'm not getting that and if i
look here it's not getting through here
at all
so what i need to do is open it up
oh it has a lot of hosts is wide open
so let's try to do this let's actually
run it on
there
and now let's see what we get
okay so now we are coming through
log in so i'm able to see this i don't
care to save that
um oh i guess i can blow this up a
little bit so we can see a little bit
more
and so if we go to our goals there's
nothing there if we look at our roadmaps
but we've got it because we've pulled
all our data in
and we're now running off of our other
server and we can see here from our
debug stuff that we now have our server
running
on our our demo our dev server running
on
the other side so now let's start
cleaning some stuff up
so we don't want to run with debug
turned on
on production we're going to change our
secret key at some point but we'll just
right now not worry about it too much so
we have
all of that
and now if we run we should get the same
thing we should still be able to
run
wow everything's complete there
let's pick some that are different oh
wow that was interesting that one just
totally blew up on us so what we're
going to run into
probably oh because
this is now it's picking it up that it's
production we're going to find
an error here i think
because if we take that same one let's
go back to debug
equals true
so it's here and we're gonna see if it's
false
and it's gonna blow up on us i think
well when it tries to reload
i'll shoot okay
let's do this
oh maybe it's not going to blow up on us
okay
all right well typically what happens is
it's going to end up because it's going
to the wrong
static as we start to turn stuff on so
let's go to here and what we have now is
we have it actually running
our application we've got our database
set up we've got our password
all of our blah blah blah blah blah it's
really not much else we have to do
except
we're going to deal with this static and
you're going to see right here
we'll go ahead and use their little
documentation
and we're going to see that here
let's see that's during development
serving files testing deployment
uh so here we go so we're going to have
a static route
for getting to our server so instead of
putting all them here we're going to
actually put them
out on our site somewhere and of course
we're going to do is copy all of our
files from our static into our static
route
and so here let's create
oh i'm just going to take a let's stop
this
and so now what we want to do is
we're going to go to our website and
we're going to make their
uh we need to do a pseudo
and we're going to call it dp static
and if you'll see here we don't want it
owned by root we want it owned by wwe
data
so we're going to do sudo
r just to make sure we get anything
underneath
i do that for dp static
and so now it's good now if we go to see
there now what we want to do is we need
to copy everything
that is here we need to copy this static
over to the other static so what we want
to do
what we want to do is we want to pull
our static files over so we're going to
go here
to our um
where did that go go here
oh one more level up and we're just
gonna do tar
uh put it back here static
star oh we gotta call it
static.tar that
uh let's not do that
we won't actually go up one more
because we're going to do it so that
it'll come from here and now we want to
do tar
whoops till the whoop come here
till the slash static tar star
oh and it's going to be a cvf my mistake
okay so there we go so now we can go
here
and go back to our static on our web
and then we're going to do a tar dash
xvf
our static files here so now they're all
here and so now
if we look we should be able to do
see demo one
dp static so let's make sure that that
actually
gives us something
and we can see here that we've got our
folders
so which is this is not a production
server normally you wouldn't be able to
see that so now
if we do that and we're now going to go
back to
our application
i guess this path yes this path
and we're gonna go kick this guy off and
let's see what he does for us
uh where we go here we go
and so now uh let's get rid of that for
right now
let's get rid of that for right now
and we're going to see here
let's go to like a task list here and if
we look
into our developer tools
we're going to see uh sources
and we're going to see that here we go
like dp static css it's pulling that
up so
now we did see that it didn't like
jquery
so dp statics js jquery didn't we not
have that
let's see if we go to static js
now somehow that got moved
so let's uh let's see so is that jquery
mint whoops
let's just check that real quick so he
was trying to find
jquery.js
and bootstrap bundle men so let's go
check those guys real quick bootstrap
bundle man.js should be there
so let's go check our website real quick
go to js
so he should see
bootstrap dash bundle dot
i'm going to give you the full path uh
whoops let's go check that real quick
uh dp static js bootstrap dash
bundle dot men
bundle dot man dot js
not finding it and so let's go back and
look for that
oh bootstrap.bundle
so let's just copy that
bundle dot min dot js2
bootstrap dash
bundle dot min dot js
and then we're going to also copy the
jquery
to i think we just called it jquery.js
and so now if we go look
non js module files so we just blew
something up
pretty heavily there
let's go look here
oh because our server's down so let's go
back over here
oops i think that's it let's run our
server
where'd he go there we go
okay so now if we look at our console
good we got our stuff
and things are showing up
there we go okay so now we've got and
like i said if we look at our sources
we're going to see that we're coming off
of
static so we've got our static stuff
coming through
and so now what we're going to do is
we're going to actually front
the next thing we're going to do is
we're actually front the
the servers so we're not going to be
using this anymore
we're going to actually be able to come
through and that is going to be
in the next episode and once we've got
that then we will be off and running
we'll be able to
redirect we can use our you know dns's
namespace and we can actually redirect
and we're also going to do
our https connection since if you
haven't noticed
we have been unsecure and if we do this
it's going to blow up on me see i can't
get there because i can't do
i provide a secure connection so we're
going to get all that stuff straightened
out next time so
that's something to look forward in what
will probably be a part two in our final
episode
in this series on django and python
we'll catch that next time but until
then
have yourself a great day and we will
wrap it up next time
you