Error accessing my webpage from network
<p>I've just started learning network developing using <strong>Flask</strong>. According to its official tutorial:</p>

<blockquote>
  <p><strong>Externally Visible Server</strong></p>
  
  <p>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.</p>
  
  <p>If you have the debugger disabled or trust the users on your network,
  you can make the server publicly available simply by adding
  <code>--host=0.0.0.0</code> to the command line:</p>

<pre><code>flask run --host=0.0.0.0
</code></pre>
  
  <p>This tells your operating system to listen on all public IPs.</p>
</blockquote>

<p>However, when I try to access <code>0.0.0.0:5000</code> on another device, I got an error: <code>ERR_CONNECTION_REFUSE</code>. In fact, I think this behavior is reasonable, since people all around world can use <code>0.0.0.0:5000</code> for different testing purposes, but isn't the tutorial implying that adding <code>--host=0.0.0.0</code> can make my webpage "accessible not only from your own computer, but also from any other in the network"?</p>

<p>So, my question is:</p>

<ol>
<li>What does adding <code>--host=0.0.0.0</code> do?</li>
<li>How can I access my webpage on device B while the server is running on device A?</li>
</ol>

<p>You don't access the Flask server on another computer by going to <code>0.0.0.0:5000</code>. Instead, you need to put in the IP address of the computer that it is running on.</p>

<p>For example, if you are developing on a computer that has IP address <code>10.10.0.1</code>, you can run the server like so:</p>

<pre><code>flask run --host=0.0.0.0 --port=5000
</code></pre>

<p>This will start the server (on <code>10.10.0.1:5000</code>) and listen for any connections from anywhere. Now your other device (say, on <code>10.10.0.2</code>) can access that server by going to <code>http://10.10.0.1:5000</code> in the browser.</p>

<p>If you don't have the <code>host=0.0.0.0</code>, the server on <code>10.10.0.1</code> will only listen for connections from <em>itself</em> (localhost). By adding that parameter, you are telling it to listen from connections external to itself.</p>

python flask hosting web-hosting host