I’m learning Python, and I can easily create a server on localhost, but other people somehow are able to host their website on their IP address and then use a domain provider to get a domain.
How would I go about doing this? I asked one person, and they said it was called Port Forwarding but never really told me how to do it.
I like Python, but there’s really no point in it if I can’t put my website out there for other people to use.
I tried searching this, but I can’t find any help for it. If any of you are skilled web developers, please, help a newbie out.
And I don’t get how this question was considered vague. It got a perfect answer. :I
I just asked how to IP Forward and what it is. And someone explained that.
Port Forwarding
Port forwarding is essentially giving your router the ability to say “Hey, this packet came in on port 12345, so I’ll pass it on to the computer at 192.168.1.5 .” If you’re hosting from home you’ll have to do this.
Disclaimer
There are a bunch of security risks involved if you are hosting something yourself, but it can definitely be done. Also, if you are going to use the site beyond just experimenting, you should use a more robust server like Apache.
Hosting
You’ll need to register the domain with some company, and then use their tools to have the domain point to your router’s IP address. If your router doesn’t have a static address (likely)- that is your router’s address changes from time to time- you’ll need to use a dynamic DNS (DDNS) service. Such a service essentially gives you a static IP address that points to your dynamic one; software on your router lets the DDNS servers know whenever the router’s IP changes.
From there, you can just use the router’s software to forward requests on the port of your python app to the machine it’s running on. So for an HTTP server, that would be port 80. (Like I said earlier though, just forwarding all HTTP requests to a computer running a python server is asking for trouble.)