Tag: Python

Deploying Python App to AzureWebsites

Deploying Python App to AzureWebsites

Note: This was originally created on my azurewebsite that I learned to deploy with and can be found on my github page.

I have only been programming in Python for a few months (December 2016 to March 2017) when I decided to deploy a simple Flask app to Azure. I found that the documentation was lacking, confusing and written for someone who knew both Azure deployments and Python well which is not me.

So this is the result of what I have learned so far.
What you will need 1) an Azure account, 2) FTP Client like FileZilla, and 3) some type of IDE or text editor (Notepad, Note++ or Visual Studio Code – what I use).

Deploying a Simple Site

First, you will need an Azure account. Signup for the free tier, which allows 10 Azure Websites and 1 GB of storage (as of March 2017).

Once you have signed up to Azure.

Create a New website. Web + Mobile > See All > Search for Flask > then Create your site. Once deployed you will be able to download it via FTP.

The template looks like this.
Changes for you app


Under appsettings change the FlaskWebProject1.app to whatever your app name is (folder).

Under rewrite node find the action type node url=”^/FlaskWebProject1/static/.* to you app name (folder).

App Folder Name

Change the name of the folder to whatever you named the application in web.config.
Change the from FlaskWebProject1 import app to your applications name.
Change the import FlaskWebProject1.views to your applications name.


Change from FlaskWebProject1 import app to your applications name.
Then run your application (python runserver.py) to make sure it all works. Default is localhost:5555, but I changed the port to 5000 and it has been running fine. If you are using a virtual environment ( pip install virtualenv and then env\Scripts\activate) then then make sure you have installed the requirements.txt ( pip install -r requirements.txt).

FTP your site to Azure

With your site working locally (localhost), its time to upload it to Azure. On the Azure portal for your Website, select QuickStart and Python. There are several options to deploy your application to Azure, for now we will use FTP. Select that as your option and follow the directions.


Once you have your credentials setup, use an FTP Client like FileZilla (what I am using) and setup a connection.

Once you have connected to Azure, load the entire contents of the site into Site > wwwroot.

It can take a few minutes for Azure to get your application running. But you should have your site up and running now.

Foghlaim Python

Foghlaim Python

pythonlogoI started learning python last December (2016). I have been enjoying the language, but some aspects have been a little odd to learn. It is open source, so that makes it really strange after nearly 20 years around Microsoft and other proprietary technologies.

Couple items I had to figure my way through….

  • Vernacular – Open Source has a made-up language. Whatever someone thinks is funny or cool, it gets named that way. Take Django… Sure jazz is cool, but how does that describe a full framework? Microsoft has a marketing team, so WPF (Windows Presentation Foundation) at least sounds close to what it does. So, it takes longer to get absorbed into the culture.
  • What is the way to learn? there is no cohesive path into Python, Java, or any other open source language. Still, it allows for more choices in how you like to learn, but makes it harder to adapt to the culture.
  • Which library or framework to use? JavaScript I think is the best example of this. Angular, Typescript, Node, React,… the list goes on and on. Literally

Though it has been confusing at times. I have really enjoyed the switch to Python. To help myself learn, I created an azure website to build some examples on. Still need to complete part of it, but you go to foghlaimpython.azurewebsites.net and see what tutorials I have been playing with. It includes how to get Python 3.5 running on Azure.

Oh and by the way, Foghlaim is Irish for “learning”. So Foghlaim Python is learning Python.