Git Product home page Git Product logo

cloud-services-python-contoso-ads-application's Introduction

services platforms author
cloud-services
python
msonecode

Python Contoso Ads Application Cloud Service

Introduction

Flask (Micro-framework for Python) version of the Contoso Ads application in Get started with Azure Cloud Services and ASP.NET.

Prerequisites

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.

2. Visual Studio 2013 or 2015

5. Azure Storage Account

Follow this guide to create a storage account and obtain the Access Key.

6. Azure Service Bus

Follow this guide to create a service bus and obtain the SAS key.

7. MongoDB

You may use MongoDB on Azure Virtual Machine or mLab.

Run the sample

1. Right click the project in the solution explorer and then choose Reload Project if it shows “unavailable”.

1 a

2. Modify the connection settings in WebRole1 > app > config.py.

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'

3. Modify the connection settings in WorkerRole1 > config.py.

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.

4

5. Add a new virtual environment in WebRole1.

5

6. Uncheck “Download and install packages” because we need to add some wheel files to local disk.

6

7. Repeat step 2 - 6 for WorkerRole1.

8. Find the .whl files in bin folder under WorkerRole1.

8

9. Create a bin folder in WorkerRole1 env folder and copy the .whl files to bin.

9

10. Repeat step 8 - 9 for WebRole1.

11. Run Install from requirements.txt for both virtual env.

11

12. To debug a particular role, right click on the role name and click "Set as StartUp Project".

12

Publish to Azure

You may follow this guide to publish the application to Azure Cloud Service.

Additional Information

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.

cloud-services-python-contoso-ads-application's People

Contributors

aliceqin12 avatar msonecode avatar vaanpan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.