kaku21 kaku21 - 2 months ago 9
Python Question

flask manage.py runserver can't pass parameter

user manager.py runserver my flask webframework can start on http://127.0.0.1:5000 but it can not access on other computer in network.
so i need use an open IP in network.
although i use bellow command:

manage.py runserver 192.168.49.25:8000


it can not run and give a error info:

manage.py: error: unrecognized arguments: 192.168.49.25:8000


I don't known what's wrong with it??

Answer

Read the documentation:

Externally Visible Server If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network. This is the default because in debugging mode a user of the application can execute arbitrary Python code on your computer.

If you have debug disabled or trust the users on your network, you can make the server publicly available simply by changing the call of the run() method to look like this:

app.run(host='0.0.0.0') This tells your operating system to listen on all public IPs.