This question already has answers here:
Configure Flask dev server to be visible across the network
(17 answers)
Closed 2 years ago.
I'm sorry this question has been asked before and answered.
The flask app does not serve outside of the local host network.
This is what I've tried before.
ipconfig
What I've Tried
Inbound rule change to allow port 5000.
Changing port to 80 and then to 33 to test
set host to 0.0.0.0
Tried all with app.run(host=) method and cmd line interface
is it something I'm not seeing yet. Please help. Thank you in advance.
You'll need something like ngrok to transfer outside connection to your localhost. Say you are running flask at 8080. Then to access it you'll need ngrok and the command will be ngrok http 8080. This will give another address which can be used to access flask on your localhost. Also, there are many alternates to this method, but ngrok is quick and easy.
Sorry for the vague answer but I cant help much without actually looking at the code. But have you tried running it on an apache server, I did that for a small project in my home and it worked alright.
This is the resource I found useful myself: https://dev.to/willmvs/flask-deployment-on-windows-139b
Related
This question already has answers here:
Configure Flask dev server to be visible across the network
(17 answers)
Closed 1 year ago.
I am trying to run simple hello world flask application. I followed all the steps mentioned here as I am using Ubuntu 18.04.5 LTS.
When I execute command flask run, I got following output:
But I am not able to get application run even after visiting the address http://10.142.0.2:5000. Tried using another IP address as well.
Opened port 5000, but not able to see in the list of open ports. Tried setting new firewall rule through GCP console as well.
If you are connecting via ssh you can use Gunicorn with nginx as a server. Note: They are running in the background(you can use the terminal when they are running.)
If you are trying to remove the port number you can change the port as 80
Are you trying to access your web app from another machine? That won't work because 127.0.0.1 means localhost. Try
flask run --host=0.0.0.0
This will tell flask to listen on all interfaces and not only the loopback address.
See https://flask.palletsprojects.com/en/latest/quickstart/#public-server for details.
This question already has answers here:
Configure Flask dev server to be visible across the network
(17 answers)
Closed 3 years ago.
I am noticing that the Flask default server should not be used for the production server.
However, in my case, I just want to share a prototype web application created by Flask in the company's intranet using port80.
I tried to specify port referring to stackoverflow page by the following code.
if __name__ == "__main__":
app.run(host='0.0.0.0',port=80)
But they still run on 127.0.0.1:5000. (refer to screen capture of command prompt)
Does anyone know what I should revise in order to run the flask application using port 80?
Please try to run it with
python <yourfile>.py
flask run might be a cause of your problem
As mentioned in the Documentation, flask run will run the development server on 127.0.0.1:5000 and ignore your app.run:
The run command will start the development server. It replaces the Flask.run() method in most cases.
https://flask.palletsprojects.com/en/1.0.x/cli/#run-the-development-server
So instead of using flask run just execute your script directly with Python.
The correct way to launch this using flask run is by specifying the -h flag:
flask run -h 0.0.0.0
This question already has answers here:
Is there a way to deploy new code with Tornado/Python without restarting the server?
(5 answers)
Closed 7 years ago.
I have an HTTP server created by the Tornado framework. I need to update/reload this server without any connection lost and shutdown.
I have no idea how to do it.
Could you get me any clue?
Easy way, do it with nginx.
Start a latest tornado server.
Redirect all new connections to the new tornado server.(Change nginx configure file and reload with nginx -s reload)
Tell the old tornado server shutdown itself if all connections are closed.
Hard way
If you want to change your server on the fly, maybe you could find a way by reading nginx's source code, figure out how nginx -s reload works, but I think you need to do lots of work.
This question already has answers here:
How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
(3 answers)
Closed 8 years ago.
I am running a dedicated server on Digital Ocean. My site uses Flask on NGINX through Gunicorn. During development I plopped a search engine (solr) on a local VM (through VMWare Fusion) which happens to be running Tomcat. It could have been running any web server per my question. In my app I make all search requests to that local ip: 192.168.1.5. Now, when I install Tomcat on my server and run it you can see it publicly at mysite.com:8080. There's the old welcome screen of Tomcat for the world to see. I want my app to be able to access it locally through localhost:8080 but not show it to the world. Is this possible?
The short answer is no.
While using a hosting plan, so actually anything that you are doing is 'exposed to the world' since you yourself have to access it remotely, like everyone else.
You have two options, the first, configure the Digital Ocean server to only accept connections from your public IP, and the second, keep using your development server locally until you are ready for primetime.
How can I deploy cherrypy along with IIS. I am not able to reach the machine from outside using the IP. If i run using localhost it works. If I give the ip address in the browser from a different machine then IIS7 comes up.
Thanks
Raman
It would help if you posted more information about your problem but this kinda sounds like a classic configuration issue. If you have CherryPy listening on localhost (127.0.0.1) then it will only answer on that address. You have to configure it to listen on the external IP address if you want it to answer there. Here is another question that covers how to do this.
It also sounds like you are trying to run CherryPy on a box that also has IIS7 running. If this is the case, and you wish to continue to run both, you will either need to configure CherryPy to use a different port than IIS7 or you will have to configure IIS7 to redirect requests to CherryPy. Here is a similar question about doing the latter with IIS6