w5m
w5m

Reputation: 2316

Unable to publish Django project to Azure Web App from VS2015

I've written a Django project in Visual Studio 2015 which runs successfully on a local server when debugging via the IDE. However, when I...

  1. Right-click the project in Solution Explorer and select Publish
  2. Select Microsoft Azure Web Apps as the publish target
  3. Click New... and enter details to create a new web app on Azure:
    • creating a new App Service Plan with the same name as the Web App
    • creating a new Resource Group with the same name as the Web App
    • Region: North Europe
    • Database server: No database
  4. Click Create
  5. Select Publish method: Web Deploy and successfully Validate Connection to new Azure Web App
  6. Click Publish

...the Output window shows that the Publish failed:

------ Publish started: Project: RaceLogger, Configuration: Debug Any CPU ------
Validating Web Deploy package/publish related properties...
Gather all files from Project items @(Content). Adding:
app\templates\app\performance_form.html;app\templates\auth\login.html;app\templates\index.html;app\templates\layout.html;app\templates\app\performance_detail.html;app\templates\app\performance_list.html;requirements.txt
Gather all files from Project output (IntermediateSatelliteAssembliesWithTargetPath). Adding:
Gather all files from Project items @(ReferenceCopyLocalPaths,ReferenceComWrappersToCopyLocal,ResolvedIsolatedComModules,_DeploymentLooseManifestFile,NativeReferenceFile).
Gather all files from Project items @(AllExtraReferenceFiles). Adding:
Gather all files from Project items @(_binDeployableAssemblies). Adding:
DjangoStaticUrlSetting=/static/
Regenerating web.config
Copying file from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python Tools\web_config.xml" to "obj\Debug\web.config".
Updating app settings in web.config
Made 1 replacement(s).
Updating rewrite conditions in web.config
Made 1 replacement(s).
Updating FastCGI handlers in web.config
Made 1 replacement(s).
Copying file from "obj\Debug\web.config" to "C:\Users\username\Documents\Files\Web_Projects\django\RaceLoggerProject\RaceLogger\web.config".
Regenerating web.debug.config
Copying file from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python Tools\web_debug_config.xml" to "obj\Debug\web.debug.config".
Updating ptvsd secret in web.debug.config
Made 1 replacement(s).
Copying file from "obj\Debug\web.debug.config" to "C:\Users\username\Documents\Files\Web_Projects\django\RaceLoggerProject\RaceLogger\web.debug.config".

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

I've checked that the newly created Azure Web App is running via the Azure Management Portal and have modified the Web App's Application settings so that Python version 3.4 is selected (in my local environment I'm running Python 3.4.4 and Django 1.9.3) to no avail. I've tried updating to VS2015 Update 2 RC, but this makes no difference either.

I've also tried creating the sample Django Web Project available in the New Project window of VS2015 in a Python 3.4.4 / Django 1.9.4 virtual environment and that fails to publish in exactly the same way.

Does anyone have any suggestions as to how to successfully publish a Django project to an Azure Web App from VS2015?

Any assistance would be much appreciated.

Upvotes: 3

Views: 827

Answers (1)

Gary Liu
Gary Liu

Reputation: 13918

Have you tried to use virtual environment to specify your python version, which will not be limited by Python versions on Azure Web Apps Service.

Right click the Python Environments section under the solution, click the Add Virtual Environment.

enter image description here

Select the python version, mark Download and install packages, click Create button to create a new virtual enviroment under your solution directory. enter image description here

Press F5 to debug for testing the application, then try to deploy to Azure again.

Upvotes: 1

Related Questions