Flask app doesn't builds on MS Azure cloud
<p>I want to deploy my flask web application on Azure cloud. In Deployment options, I have selected GitHub as source destination for my flask code. after doing the configuration test successfully, the init.py file now starts building;<a href="http://i.stack.imgur.com/9vwfW.png" rel="nofollow"><img src="http://i.stack.imgur.com/9vwfW.png" alt="enter image description here"></a></p>

<p>Now when I go to my application link, it shows me this;<a href="http://i.stack.imgur.com/tWZfD.png" rel="nofollow"><img src="http://i.stack.imgur.com/tWZfD.png" alt="enter image description here"></a></p>

<p>Now at this point, I went back to my deployment options, it says Building failed;
<a href="http://i.stack.imgur.com/Yjhyf.png" rel="nofollow"><img src="http://i.stack.imgur.com/Yjhyf.png" alt="enter image description here"></a></p>

<p>the log generated for this building failed can be seen in the first picture. All the tests has passed except the last one "Performance test". Have anyone encountered the same issue before ? what can be the reason for that ?</p>

<p>I am running the application on localhost @ port 8000.</p>

<pre><code>from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
  return "Hello World!"

if __name__ == "__main__":
  app.run()
</code></pre>

<p>Do I need to run it on another IP ? </p>

<p>Based on your <code>500</code> error, I think some python packages are not installed correctly.</p>

<p>To check your code is working correctly in naive manner, do as follows.</p>

<ol>
<li>If you are developing on Windows machine, copy all of your <code>site-packages</code> files in development machine to WebApp <code>/site/wwwroot/env/Lib/site-packages</code> folder.</li>
<li>Hit <code>Restart</code> in Azure Portal and <code>F5</code> in browser.</li>
</ol>

<p>If it works, your deployment process might have a problem. Mainly it is caused by library installation.</p>

<p>First, check you have <code>requirements.txt</code> at the root folder. <a href="https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/#git-publishing" rel="nofollow">This documentation</a> describes some considerations to load Flask on Azure WebApp. Of course, it would be <em>really</em> helpful to read the documentation from the first line carefully.</p>

<p>Second, login WebApp via FTP and check the package is installed correctly. You can see <code>/pip</code> folder has <code>pip.log</code> file, and <code>/site/wwwroot/env/Lib/site-packages</code> folder has its libraries. </p>

<p>For some libraries which you might require more than simple hello world app, you may have to push x86 <code>.whl</code> files along with python codes as they are not installed correctly in x86 environment.</p>

<p>Additionally, in order to show internal error to outside, consider to apply <a href="http://stackoverflow.com/a/15174092/361100">this option</a> during development (not for production).</p>

python azure flask azure-web-sites