在Azure上部署Django应用程序:即使部署后也仅显示默认应用程序 [英] Deploy Django App on Azure: only displays default app, even after deployment

查看:146
本文介绍了在Azure上部署Django应用程序:即使部署后也仅显示默认应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Webapp部署到Azure.我正在按照以下说明进行操作 https ://azure.microsoft.com/zh-CN/documentation/articles/web-sites-python-create-deploy-django-app/

I am trying to deploy a webapp to Azure. I am following these directions https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/

第一步,我在门户网站上创建了一个webapp(Django).

First step, I created a webapp (Django) on the portal.

然后,它说要按照说明在Azure App Service中使用GIT配置连续部署.显然,这应该导致我拥有Django文件的本地目录. https://azure.microsoft.com/zh-CN/documentation/articles/web-sites-publish-source-control/

Then it says to follow the directions to configure Continuous deployment using GIT in Azure App Service. This should apparently lead to my having a local directory of Django files. https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/

因此,我遵循这些指示,安装Git,创建本地存储库,添加网页,启用Web应用存储库,部署.

So I follow those directions, installing Git, creating a local repository, adding a webpage, enabling web app repository, deploying.

现在,网络门户显示我已经部署(活动"部署).但是,当我转到Web应用程序的URL时,显示的不是我部署的内容,而是我猜测的是带有其URL(登录,注销,联系人)的默认Django应用程序.

The webportal now shows that I have deployed ('active' deployment). However, when I go to the web app url, what's showing is NOT what I deployed, but rather what I guess is the default Django app with its urls (login, logout, contacts).

因此,我然后在本地目录中创建了一个实际的Django应用程序(而不是从说明中获取的静态index.html).我提交并将其推送到Azure.它显示为已部署.

So then I create an actual Django app in my local directory (instead of the static index.html from the directions). I commit and push it to Azure. It shows as being deployed.

结果与之前相同:显示默认的Web应用程序.

The result is the same as before: the default web app is showing.

因此,我缺少的是本地存储库与实际显示的内容之间的连接.有什么方法可以将Azure默认应用程序拉到我的本地资源库中吗? (一旦它存在,我将能够根据需要对其进行更改.)

So what I'm missing is the connection between my local repository and what's actually showing. Is there some way to pull the Azure default app into my local repository? (Once it's there, I'll be able to change it as I see fit.)

推荐答案

一切正常,但是您最终在第一次Git提交中覆盖了Django应用.书面的持续部署"说明对任何部署都是通用的,甚至是空白的Web App.

Things are working as expected, but you ended up overwriting the Django app in your first the Git commit. The Continuous Deployment instructions as written are generic to any deployment, even a blank Web App.

因此,我缺少的是本地存储库与实际显示的内容之间的连接.有什么方法可以将Azure默认应用程序拉到我的本地资源库中吗? (一旦它存在,我将能够根据需要对其进行更改.)

So what I'm missing is the connection between my local repository and what's actually showing. Is there some way to pull the Azure default app into my local repository? (Once it's there, I'll be able to change it as I see fit.)

所有您需要做的是在Azure Web App上初始化本地Git存储库后的git clone存储库.您已经完成了大多数这些步骤,但是我将在此处将其包括在内,以供其他可能正在寻找此答案的人使用.

All you need to do is git clone your repo after you've initialized your local Git repo on the Azure Web App. You've already gone through most of these steps, but I'll include them here for others who may be looking for this answer.

从Azure市场/画廊创建Django Web应用后,向下滚动以设置连续部署.

After you create the Django Web App from the Azure Marketplace/Gallery, scroll down to set up continuous deployment.

选择本地Git存储库.

请注意,您现在在Quickstart Essentials信息中和所有设置>>属性下都有一个Git克隆URL.继续并复制此URL.

Notice that you now have a Git Clone URL in both your Quickstart Essentials info and under All Settings >> Properties. Go ahead and copy this URL.

如果您尚未这样做,则可能需要设置或重置您的部署凭据.您可以在所有设置下找到它.这将是您的Git& FTP凭证. 请注意,这实际上是您的Microsoft帐户的凭据,而不仅仅是这个Web应用程序.

If you haven't already done so, you may need to set or reset your Deployment Credentials. You'll find this under All Settings. This will be your Git & FTP credentials. Note that this is actually the credentials for your Microsoft Account, not just this one Web App.

您从第一次尝试就已经安装了Git.现在,您应该能够导航到要将存储库克隆到的文件夹并运行:

You already have Git installed from your first attempt. You should now be able to navigate to the folder you want to clone the repo into and run:

git clone <your_git_clone_url>

输入密码后,您将在本地系统上获得Django Web App的克隆存储库. cd进入目录并从那里开始工作.进行更改后,将git add .git commitgit push它们返回到Azure中的存储库中,以查看在那里的更改.

After you type in your password, you'll have a cloned repo of the Django Web App on your local system. cd into the directory and start working from there. Once you have changes, git add ., git commit, and git push them back to the repo in Azure to see your changes there.

这篇关于在Azure上部署Django应用程序:即使部署后也仅显示默认应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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