One more thing...

If you are not using Microsoft Azure Tools 2.4 or later, you will need to finish configuring your web role:

  1. Open your ServiceDefinition.csdef file:
  2. Find your new <WebRole role="{your project name}"> element.
  3. Paste the XML below as a child of the WebRole element.

(If you have Microsoft Azure Tools 2.4 or later, this code has already been added.)

Configuring Deployment

While the code above and the included PowerShell scripts may be edited freely, it is possible to set most configuration options through your Python project.

To specify the version of Python your web should run with, make it the active environment for your project. (Ensure that you have a WebPI reference or startup task to install this version on the instance - see the documentation in ConfigureCloudService.ps1 for more details.)

If your version of Python cannot be detected using the CPython registry keys after it has been installed, you can add the DeployedPythonInterpreterPath property to your Python project by editing the .pyproj file. This path will take precedence over the active environment.

To install packages using pip, update the requirements.txt file in the root directory of your project.

To set PYTHONPATH (or equivalent) before running the web, add the necessary Search Paths to your project.

To specify your main handler script, make it the startup file in your project. Alternatively, you can set the full importable name of your WSGI app in Project Properties\Web\WSGI Handler.

Troubleshooting Deployment

If your web role does not behave correctly after deployment, check the following:

  1. Your Python project includes a bin\ folder with (at least):

  2. Your Cloud project includes the above XML and the command lines match.

    Earlier versions of PTVS would create similar XML with a different command line. If this exists, it should be removed when you add the above XML.

  3. Your Python project includes either:

  4. Enable Remote Desktop on your Cloud Service and investigate the log files.

    Logs for ConfigureCloudService.ps1 are stored in the following path on the machine instance:

  5. Start a discussion at our discussion forum for further help.

This readme file may be deleted when you no longer need it.