我在Visual Studio 2015中编写了一个Django项目,它在通过IDE进行调试时在本地服务器上成功运行。然而,当我...无法将Django项目从VS2015发布到Azure Web应用程序
- 右键单击Solution Explorer中的项目,并选择发布
- 选择
Microsoft Azure Web Apps
作为发布目标 - 点击新建...,进入细节打造在Azure上一个新的Web应用程序:
- 具有相同的名称作为Web应用程序
- 科瑞创建一个新的
App Service Plan
荷兰国际集团新Resource Group
具有相同的名称作为Web应用程序 Region
:北欧Database server
:没有数据库
- 点击创建
- 选择发布方法:
Web Deploy
并成功验证连接到新的Azure Web App - Click Publish
... Output窗口显示,发布失败:
------ 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更新2 RC,但这也没有任何区别。
我也尝试在Python 3.4.4/Django 1.9.4虚拟环境中的VS2015的New Project窗口中创建示例Django Web Project
,并且无法以完全相同的方式发布。
有没有人有任何建议,如何成功地发布一个Django项目从VS2015的Azure Web应用程序?
任何援助将不胜感激。
我按照你的步骤在Visual Studio中创建了示例Django Web Project。添加了一个虚拟环境(Python 3.4,Django 1.9.4)。它发布到Azure Web应用程序没有任何错误。我可否知道您在虚拟环境中使用了哪个Python版本? –
嗨甘达利,当我创建Django Web项目示例时,我使用了Python 3.4.4/Django 1.9.4虚拟环境。 – w5m
@ w5m,我尝试按照以下步骤重现此问题: 1.创建Django项目并添加名为**'env'**的虚拟环境。 2.安装完所有依赖关系后重新生成requirements.txt文件。 3.使用VS部署网站,并按照你的描述和网站工作。您可以请遵循以下文档:https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/或者您可以使用GitHub来部署您的网站(http:// blog。 smarx.com/posts/tutorial-running-a-python-web-application-in-windows-azure) –