【发布时间】:2016-03-07 15:30:24
【问题描述】:
我在 Visual Studio 2015 中编写了一个 Django 项目,当通过 IDE 进行调试时,它可以在本地服务器上成功运行。但是,当我...
- 在解决方案资源管理器中右键单击项目并选择发布
- 选择
Microsoft Azure Web Apps作为发布目标 - 单击 New... 并输入详细信息以在 Azure 上创建新的 Web 应用程序:
- 创建一个与 Web 应用同名的新
App Service Plan - 创建一个与 Web 应用同名的新
Resource Group -
Region: 北欧 -
Database server: 没有数据库
- 创建一个与 Web 应用同名的新
- 点击创建
- 选择发布方法:
Web Deploy并成功验证连接到新的 Azure Web 应用 - 点击发布
...输出窗口显示发布失败:
------ 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 ==========
我检查了新创建的 Azure Web 应用程序是否正在通过 Azure 管理门户运行,并修改了 Web 应用程序的 Application settings 以便选择 Python 3.4 版(在我的本地环境中,我正在运行 Python 3.4.4和 Django 1.9.3) 无济于事。我试过更新到 VS2015 Update 2 RC,但这也没什么区别。
我还尝试在 Python 3.4.4 / Django 1.9.4 虚拟环境中创建 VS2015 的“新建项目”窗口中可用的示例 Django Web Project,但无法以完全相同的方式发布。
有人对如何从 VS2015 成功将 Django 项目发布到 Azure Web App 有任何建议吗?
任何帮助将不胜感激。
【问题讨论】:
-
我按照您的步骤在 Visual Studio 中创建了示例 Django Web 项目。添加了一个虚拟环境(Python 3.4、Django 1.9.4)。并且它没有任何错误地发布到 Azure Web 应用程序。请问您在虚拟环境中使用的是哪个 Python 版本?
-
您好 Gandhali,当我创建示例 Django Web 项目时,我使用了 Python 3.4.4 / Django 1.9.4 虚拟环境。
-
@w5m,我尝试按照以下步骤重现此问题: 1. 创建 Django 项目并添加名为 'env' 的虚拟环境。 2. 安装完所有依赖后重新生成requirement.txt文件。 3.使用VS部署网站并按照您的描述和网站工作。请您关注文档:azure.microsoft.com/en-us/documentation/articles/… 或者您可以使用 GitHub 部署您的网站 (blog.smarx.com/posts/…)
标签: python django azure visual-studio-2015 azure-web-app-service