Python for Entrepreneurs Transcripts
Chapter: Deploying to the cloud
Lecture: Domain names
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
So far we've been working with the IP address of our Digital Ocean droplet, but we're not going to have people connect
0:08
directly to the IP address, we want a domain name. If you've ready got a domain name for your business, that's awesome;
0:14
if not, we'll use name cheap to get the domain name and then configure its records under the domain name service, the DNS,
0:21
to point to your Digital Ocean server. DNS provides the bridge between a nice name like fullstackPython.com
0:28
or talkpython.fm and the server or a group of servers that are running serving up your application.
0:35
Bring up in a web browser and go to the domain name register of your choice. I use Namecheap for just about everything,
0:41
and I've been using them for several years, so haven't had any issues with them. Sign up for an account, or sign into your existing account,
0:47
and you can register for a domain name. I'm not going to walk through the whole domain name registration process,
0:52
but it essentially you search for a domain name, buy it, and then it will be added to your domain list.
0:57
So today, I've registered for Pythondeploymentexample.com and now it appears on my domain list.
1:02
First thing you want to do is go click the manage button, which will bring out more configuration options for your domain name.
1:07
The only thing we really need to configure here is under advanced DNS, this is where you set the host records
1:13
that will connect from the domain name to your server. Now as you can see, there is a couple of default host names that are set here
1:21
and this brings up a parking page for a Namecheap, just a default parking page that says like this domain name has been registered at Namecheap
1:29
We don't really want that, we want to point this to our Digital Ocean server. So change the type to an a record, that's an address record,
1:36
leave the host www, and then change the value to your IP address. Now again, you should know your IP address, but if you don't
1:44
switch back over into your Digital Ocean droplet list, click on your IP address to copy it, go back into advance DNS, and paste it in.
1:54
We can save that by adding a little check mark, and then the one other change we want to make,
2:02
we're going to have a URL redirect record, the @ symbol is for a naked domain so in our case, that is going to be Python,
2:13
if you were to type in Pythondeploymentexample.com, without the www, it's going to redirect to the www version;
2:22
typically, you are not going to want to use the naked domain, you're just going to want to use the www version.
2:28
There's some esoteric rules why that's the case, but that's simply how I set mine up, we won't get into those rules,
2:34
but that's the recommended practice I'd say you should follow. Now, instead of just http, what we're going to have instead
2:42
we're going to point it to the https version, we'll leave it as unmasked,
2:45
and save the changes, that's really all we need to do to set up or host records. What we'll find is now if we go to Pythondeploymentexample.com
2:53
it is going to try to contact our server. We can tell because if we go to the network tab, and then we click on this,
3:01
and it actually redirected us to exactly what we specified, https://www.Pythondeploymentexample.com but our server is not serving anything up yet,
3:11
we haven't configured our web server nginx to respond to requests in fact, we haven't even installed it yet.
3:18
So that's what we were going to do in the next couple of videos, but the reason why we had to set our domain name up first, there was two reasons:
3:23
number one, when you change these records, it can often take 15, 20, 30 minutes to propagate to all of the DNS servers around the world.
3:32
These changes often don't take effect immediately, so sometimes you have to give them a little bit of time if you make changes.
3:38
The second reason is, we're going to use a service called Let's Encrypt to create an SSL certificate, and it has to be pointing to the specific server
3:45
or IP address in order to use their service. So now that we've got that set up, we are ready to continue configuring our server
3:54
and getting ready to load our source code for our application.