Python Making my web page publicly available

  • Thread starter Thread starter olgerm
  • Start date Start date
  • Tags Tags
    Python Web
Click For Summary
To make a web page publicly available, using a home computer without a static IP can be challenging, as most ISPs do not allow hosting servers on residential connections. A recommended approach is to use a hosting service, which can support Python and Flask applications, ensuring the site remains accessible. Dynamic DNS services can also be utilized to manage changing IP addresses if hosting from home is preferred. It's crucial to configure the router to forward the correct ports and ensure security measures are in place to protect the server. Ultimately, using a hosting service like PythonAnywhere is a practical solution for beginners wanting to make their web page available online.
olgerm
Gold Member
Messages
532
Reaction score
35
I want to make a web page. I made it work in local network using python and Flask module. It also saves and uses data in responses, that it has got by GET and POST requests. What should I do to make it publicly available so that I had to change the original script with flask as little as possible? I want people to be able to connect it by my ip address or I could buy a domain. I am a beginner in such things and I just want to make my web page available. Could anybody teach me how to do it?
 
Technology news on Phys.org
olgerm said:
or I could buy a domain
That's the way I would do it... :smile:
 
You won't be able to provide a useful service based on the usual form of home or small business internet access.
For one thing you need a static IP, that isn't the deal with most domestic providers, your IP can change, it's up to them.
Even with a static IP, domestic user band width could barely support more than 3 or 4 simultaneous users.
Yes, buy a domain, there are companies which provide that and the necessary server resources you will need at reasonable prices.
I won't recommend a particular one, but there are some that which let you experiment for free until you have a serious site going.
 
  • Like
Likes berkeman
I think in the US, most or all Internet service providers forbid residential-service customers from operating publicly accessible servers. They may even use a firewall to block outbound connections from such servers. In other countries the situation may be different.
 
rootone said:
could barely support more than 3 or 4 simultaneous users.
It is very small page (few kilobytes). I do not expect many users.

I want firstly make it available on my ip address before buying a domain. What code should I run to make my page available on my ip address?

Later if I buy a domain - is it then related with my ip in DNS servers and all requests to that domain are directed to my ip?
 
Yes, you have the right idea about how DNS servers work.

As jtbell pointed out though, you may find that your ISP simply doesn't provide that kind of facilty for domestic users, even though it's possible in theory.
The way it's usually done is you get another IP, separate from your home one.
That IP addresses a server which you have rented the use of.
You can develop the site on your own PC, then upload it to that server when it looks all good.
The server you use does not have to belong to your ISP, there are companies which specialise in providing server resources.
As I said there are some who provide entry level service free, at least there were a few years ago.
It is of course the server bandwidth and storage which you pay for, they don't physically install anything at your home.
The physical server gear could be located anywhere in the world,
 
Last edited:
I'd like to get more specific tips.

rootone said:
You may find that your ISP simply doesn't provide that kind of facilty for domestic users
I don't know if my ISP does or not. Is there a easy way to find out if it does? I prefer hosting my page from my own computer if it is possible.
What kind of source code I need to run to host my site on my ip or to upload to hosting server if I choose to rent a server? Can you give simple HelloWorld-example? The code that I have currently written and works in local network is in python3 and uses flask module.
 
I guess the customer support at your ISP will be the people to ask.
Chances are they will try to sell you a business package that works the way I described above, by you renting some server capacity from them.
All you actually need though is a static IP which they won't change at a whim.
If they offer that at all, there very likely will be a price for it that's similar to the server rental approach.

As for actually implementing a site there are different methods.
The simplest is to write HTML fixed content pages, but that's very limiting.
Once you have got to grips with that, you'll need to look at how HTML pages can be generated from a database, and extending beyond what HTML can do, using scriptng languages like javascript
 
Last edited:
  • Like
Likes olgerm
rootone said:
how HTML pages can be generated from a database, and extending beyond what HTML can do, using scriptng languages like javascript
I have already made that with python and flask module, but It works only in local network. I do not need any script on client side.

I do not have static IP so I will use hosting service. Most important question is that how should I modify the source code before uploading it to hosting server. Can it remain in Python?
 
  • #10
You will need to be assured that the server you use does in fact run Python, which is not something you can count on.
If it does, then your program should work the same as it does for local network.
 
  • #11
There are some advantages to running your website on your home pc rather than using a shared hosting service. For one, you will not be limited to traditional server side scripting, such as PHP or ASP. You can do anything you want in the back-end. You can have complete and fast access to everything.

But the two big deterrents are the security risks and your ISPs TOS. There's not a lot you can do about the former. There are steps you can take to decrease the risks, but you still have to open up your computer to the outside world. There's no way around it. As for the latter, you can try and find an ISP that allows home servers if your current one doesn't. Or your current ISP may allow it with a higher priced account.

There's too much involved in setting up a home server for me to go into in a forum post, but there's lots of info on the web if you just do a little research. I will give you one link to get you started: https://www.boutell.com/newfaq/creating/hostmyown.html

Also, setting up a home server is not as easy as using a hosting service. But it's a good way to learn about how the Internet works. If you have lots of time and you can manage the two deterrents I mentioned and you want to learn, then it might be worth it for you to give it a try. Otherwise, I would recommend, as the others have, that you pay for a hosting service.
 
Last edited:
  • Like
Likes olgerm and rootone
  • #12
As I understood I can not run my website on my home computer, if I do not have static IP. I do not have static IP. because of that I used hosting service Pythonanywhere. The page is now available at http://olger.pythonanywhere.com .
 
  • #13
olgerm said:
As I understood I can not run my website on my home computer, if I do not have static IP.
That's what many people think, but it's not true. You can use a Dynamic DNS service such as No-IP.com. However, you will have to use a subdomain of one of their supplied domain names such as yourdomain.theirdomain.com. Here's how it works, briefly: You create an account with the DDNS service, you choose a domain name, you tell it what your current IP is, you download and install their update client. The update client notifies the DDNS service whenever your IP changes and your domain name will be updated automatically to point to your new IP. This is the same way it works for security appliances such as IP cameras. It's all perfectly legal (if your ISP allows home servers). Some modem routers already include update clients in their firmware that's compatible with certain DDNS providers.
 
  • #14
olgerm said:
I'd like to get more specific tips.

I prefer hosting my page from my own computer if it is possible.

Here's what I do with my home server:

1. Setup dynamic DNS like TM suggested above.
2. Configure a static IP on your internal web server (usually 192.168.x.x or 10.x.x.x).
3. Configure your internet router/firewall to forward port 80/TCP to your internal web server's static IP.
4. Optional for a bit of security through obscurity - Configure the firewall to listen on a random high port and redirect to the internal default port 80 - Access from outside via httx://blah.blah.blah:randomport#
The code that I have currently written and works in local network is in python3 and uses flask module.
There shouldn't be any reason to modify the code, just be careful what you expose to the web so you don't get hacked.
 
  • Like
Likes olgerm
  • #15
http://olger.pythonanywhere.com
I can see your page!
What language is that though, Finnish?
 
  • #16
rootone said:
http://olger.pythonanywhere.com
I can see your page!
What language is that though, Finnish?
It is in estonian, but I will add english soon.
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
7
Views
2K
Replies
7
Views
3K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K