Python Flask - Give domain name to Flask WebServer
This article continues with the previous post.
In the simple web server using Flask, the IP address was used to connect directly.This time, I'll change it to use the domain name.
The test server does not have any problems using the public IP. However, if you use a router, you can use the port forwarding function to connect to the test server over the Internet. In this article I will configure a server that uses public IP directly.
Buy a domain name
Most domain names are purchased for a fee and used for a period of time, but there are domains that are available for free, including domains in some African countries. Get a domain for free and use it on a Flask web server on a server with a public IP.
Get a free domain at www.freenom.com
Visit https://www.freenom.com and search for the domain name you want to use. I used the domain name spypiggy, which was mostly available in African country domains.
Select the domain you want to use and click the Checkout button at the top.
Now Freenon receives your email address and a confirmation email is sent to you. And if you follow the url of the authentication email, you will go through the membership registration process. You can find many documents on how to use freenon through Google search.
After signing up for membership, log in. And you can check the domain you just created by going to the services -> My Domains menu.
Click the Manage Domains button and enter the IP address associated with the domain name. Naturally, you should use a public IP address here.
Manage Freenom DNS
It takes some time for the DNS values specified above to be applied. After 5-10 minutes, check if the spypiggy.ga domain is associated with the IP address using the nslookup command. You can see that Google DNS is correctly handling the newly added spypiggy.ga and www.spypiggy.ga domain names and IP addresses.
f:\study\python>nslookup spypiggy.ga Server: dns.google Address: 8.8.8.8 Non-authoritative answer: Name: spypiggy.ga Address: 117.52.89.240 f:\study\python>nslookup www.spypiggy.ga Server: dns.google Address: 8.8.8.8 Non-authoritative answer: Name: www.spypiggy.ga Address: 117.52.89.240
Run the flask example tested in the previous article on spypiggy.ga (117.52.89.240) and test it using your browser.
If the firewall of the Flask web server you want to test allows 8080 port access, you will be able to connect from the outside as shown in the following figure.
댓글
댓글 쓰기