python - 无法从 VS2015 将 Django 项目发布到 Azure Web App

标签 python django azure visual-studio-2015 azure-web-app-service

我在 Visual Studio 2015 中编写了一个 Django 项目,通过 IDE 进行调试时,该项目在本地服务器上成功运行。然而,当我...

  1. 在解决方案资源管理器中右键单击该项目,然后选择发布
  2. 选择 Microsoft Azure Web Apps 作为发布目标
  3. 点击新建...并输入详细信息以在 Azure 上创建新的 Web 应用:
    • 创建与网络应用同名的新应用服务计划
    • 创建一个与 Web 应用同名的新资源组
    • 地区:北欧
    • 数据库服务器:无数据库
  4. 点击创建
  5. 选择发布方法:Web 部署并成功验证连接到新的 Azure Web 应用
  6. 点击发布

...输出窗口显示发布失败:

------ 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 应用程序的应用程序设置,以便选择 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 项目,但该项目无法准确发布同样的方式。

有人对如何从 VS2015 成功将 Django 项目发布到 Azure Web 应用程序有任何建议吗?

任何帮助将不胜感激。

最佳答案

您是否尝试过使用虚拟环境来指定您的Python版本,这样就不会受到Azure Web Apps Service上的Python版本的限制。

右键单击解决方案下的Python 环境部分,然后单击添加虚拟环境

enter image description here

选择python版本,勾选下载并安装包,点击创建按钮在您的解决方案目录下创建一个新的虚拟环境。 enter image description here

按 F5 调试以测试应用程序,然后尝试再次部署到 Azure。

关于python - 无法从 VS2015 将 Django 项目发布到 Azure Web App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847600/

相关文章:

python - 计算每个 bin 中 numpy ndarray 的最大值

python - 返回 int(值) ValueError : invalid literal for int() with base 10: 'Umi Falafel'

azure - 在启用自动缩放之前,如何确保 Multi-Tenancy Azure 应用程序中的 Quartz.NET 调度兼容性?

python - 从与 __init__ 导入同名的 python 模块导入对象

python - Pandas :当列值是字典时如何按列值分组?

python - 全局变量如何/为什么可用/在嵌套类实例的范围内,但 "nonlocal"变量不可用?

django - Django 1.7、uwsgi 和 PostgreSQL 的随机数据库错误

python - Django 无法加载静态文件

asp.net - Azure 上的联合身份验证

python - 如何将文件夹上传到 Azure blob 存储,同时保留 Python 中的结构?