通过Visual Studio 2017在Azure中部署Django Web应用 [英] Django web app deploy in Azure via Visual Studio 2017

查看:73
本文介绍了通过Visual Studio 2017在Azure中部署Django Web应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2017中的默认模板(文件-新建-项目-python-django网络应用程序)在Django中使用Visual Studio 2017创建了一个简单的应用程序。
该应用程序在本地正常运行,但是在我通过Visual Studio将其部署到Azure之后,我只能访问显示以下页面:

 您的App Service应用已创建。 

文件均已正确上传(我可以在 site\wwwroot文件夹中看到它们) ,但该应用无法正常运行!



我已经尝试了所有在搜索中都能找到的东西,例如:教程;将'.azurewebsites.net'添加到允许的主机中,通过以下方式在我的项目虚拟环境中安装azure sdk:'pip install azure',将'manage.py'添加到默认文档中。



问题是当我将ASP.NET应用程序部署(以完全相同的方式:右键单击该项目,选择发布,蔚蓝...)到Azure时,它们可以以最小的工作量正常工作。 / p>

我非常沮丧,因为我真的很喜欢Django框架和Azure,请提供帮助。



提前谢谢!

解决方案

经过艰苦的努力,我设法做到了!



我将解释我是如何做到的(我已经使用了许多教程和论坛帖子答案来实现这一点):



1)我创建了Django(PTVS)网站Azure中的应用;



2)关注了教程来配置该应用;



3)对web.config文件进行必要的调整在我的项目中,特别是通过扩展名安装的python版本的路径;



4)通过Visual Studio 2017将我的项目发布到第一步中创建的Django应用。 / p>

而且有效!


I've made a simple app with Django in Visual Studio 2017, utilizing the default template in Visual Studio (file - new - project - python - django web application). The app runs properly locally, but after i deploy it to Azure via Visual Studio, i can only access the page that shows:

Your App Service app has been created.

The files are all properly uploaded (i can see them in the 'site\wwwroot' folder), but the app doesn't work!

I have tried every thing that i was able to find in my searches such as: following this tutorial; adding '.azurewebsites.net' to the allowed hosts, installing azure sdk in my project virtual environment via: 'pip install azure', adding 'manage.py' to default documents, among many other things.

The thing is when i deploy (in the exact same way: right click the project, select publish, azure...) my ASP.NET apps to Azure, they work properly with minimum effort.

I am very frustated, because i really like Django framework and Azure, please help.

Thanks in advance!

解决方案

After much struggle i manage to to do it!

I will explain how i did it (i've used many tutorials and forum posts answers to achieve this):

1) I've created a Django (PTVS) Web App in Azure;

2) Followed this tutorial to configure that app;

3) Make the necessary adjustments to web.config file in my project, notably the path to the python version installed via extension;

4) Published my project via Visual Studio 2017 to that Django App created in the first step.

And it worked!

这篇关于通过Visual Studio 2017在Azure中部署Django Web应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆