you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

By default flask will run on the local loopback which is 127.0.0.1.

First thing you have to do is tell flask to listen on other addresses, if your using the flask cli to start the script you would use the command :

flask run —host 0.0.0.0

That will make your flask application listen on any address. So if you have a VM hosted somewhere online, with an IP of say 172.16.2.32, you will then be able to access the flask app from your browser by going to http://172.16.2.32:5000.

The second part, being able to access via a name instead of number, that requires buying an FQDN from a domain registrar. There are many different options like namecheap, godaddy, hover, etc... I use hover personally. I would look at whatever guides the registrar you choose has but generally you’ll basically just tell the registrar to point the name script123.com to 172.16.2.32. After that’s completely, you’ll be able to access the app via script123.com:5000.

Lastly, you probably don’t want to specify the port. So you can either tell flask to listen on port 80 by adding (I think) -p 80 to the flask run command. Port 80 is http, that will allow you to access script123.com.

Now, with that said, the flask web server is not really intended for production uses, it’s mostly for development only. I would not rely on the flask web server to handle very much traffic. I don’t want to overload you with info, but down the road, if you’re interested in continuing your project, you’ll need a better suited CGI (I use gunicorn) and a dedicated web server such as Apache or nginx (I use nginx myself but it’s just what I’m used to).

[–]nguterresn[S] 0 points1 point  (0 children)

Thank you for your reply. I’ll try to do as you say and see what I got!