services | platforms | author |
---|---|---|
cloud-services |
python |
msonecode |
Flask (Micro-framework for Python) version of the Contoso Ads application in Get started with Azure Cloud Services and ASP.NET.
Note that only Python 3.4 and 2.7 are natively supported by Azure (Python 3.4 by default). If you prefer 2.7 or other versions, additional configuration for startup task is required.
Follow this guide to create a storage account and obtain the Access Key.
Follow this guide to create a service bus and obtain the SAS key.
You may use MongoDB on Azure Virtual Machine or mLab.
1. Right click the project in the solution explorer and then choose Reload Project if it shows “unavailable”.
MONGODB_SETTINGS ={
'db': 'your database name',
'host': 'your MongoDB host',
'port': port number,
'username': 'your user name',
'password': 'your password'
}
STORAGE_ACCOUNT_NAME = 'your storage account name'
STORAGE_ACCOUNT_KEY = 'storage access key'
SERVICEBUS_NAMESPACE = 'your servicebus namespace'
SERVICEBUS_ACCESS_KEYNAME = 'access key name'
SERVICEBUS_ACCESS_KEYVALUE = 'access key value'
STORAGE_ACCOUNT_NAME = 'storage account name'
STORAGE_ACCOUNT_KEY = 'storage access key'
SERVICEBUS_NAMESPACE = 'servicebus namespace'
SERVICEBUS_ACCESS_KEYNAME = 'access key name'
SERVICEBUS_ACCESS_KEYVALUE = 'access key value'
MONGODB_NAME = 'your database name'
MONGODB_HOST = 'your MongoDB host'
MONGODB_PORT = port number
MONGODB_USERNAME = 'your user name'
MONGODB_PASSWORD = 'your password'
4. Right click the Python Environments section under the solution, remove the old virtual environment setting in WebRole1.
You may follow this guide to publish the application to Azure Cloud Service.
1. We use wheels to install cffi, cryptograpy and Pillow library, because in Python 3.4 normal pip installation for these libraries may fail and return error "Unable to find vcvarsall.bat". If you can successfully install all references just by defining the name in requirements, you may safely skip above step 8 - 10.
2. Startup and Runtime task logs are located in the C:\Resources\Directory{role}\LogFiles folder in the Cloud Service instance. Check ConfigureCloudService.txt if any library in requirements.txt is not successfully installed. Check LaunchWorker.err.txt for WorkerRole runtime errors.