我在 Visual Studio 2015 中编写了一个 Django 项目,通过 IDE 进行调试时,该项目在本地服务器上成功运行。然而,当我...
- 在解决方案资源管理器中右键单击该项目,然后选择发布
- 选择
Microsoft Azure Web Apps
作为发布目标 - 点击新建...并输入详细信息以在 Azure 上创建新的 Web 应用:
- 创建与网络应用同名的新
应用服务计划
- 创建一个与 Web 应用同名的新
资源组
地区
:北欧数据库服务器
:无数据库
- 创建与网络应用同名的新
- 点击创建
- 选择发布方法:
Web 部署
并成功验证连接到新的 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 应用程序的应用程序设置
,以便选择 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 环境部分,然后单击添加虚拟环境。
选择python版本,勾选下载并安装包,点击创建按钮在您的解决方案目录下创建一个新的虚拟环境。
按 F5 调试以测试应用程序,然后尝试再次部署到 Azure。
关于python - 无法从 VS2015 将 Django 项目发布到 Azure Web App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847600/