title: Running flask app automatically after boot does not work correctly
body: <p>I am setting up Flask project in Raspberry Pi (python 2.7).
  It runs perfectly when the python script is called manually.</p>
  
  <p>However, I am trying to run the script automatically after boot, it cannot run properly.</p>
  
  <p>I have tried modifying /etc/profile to run the script after boot;</p>
  
  <p><b><i>/etc/profile</i></b></p>
  
  <pre><code># at the end of the profile
  #TRIED sudo python /home/pi/project/script.py &amp;
  #TRIED sleep 10;sudo python /home/pi/project/script.py &amp;
  
  sudo python /home/pi/project/start_script.py &amp;  # it also fails
  
  </code></pre>
  
  <p><b><i>start_script.py</i></b></p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  import time
  
  time.sleep(10)
  os.system('sudo python /home/pi/project/script.py &amp;')
  </code></pre>
  
  <p>I expect running the server without any problem but after boot, it gives me following error,</p>
  
  <pre><code>socket.error: [Errno 98] Address already in use
  </code></pre>
  
  <p>However, it does not make sense as this should only happen once.</p>
  
  <p>Am I missing anything here?</p>