如何在Azure App Service上运行django manage.py命令 [英] How to run django manage.py command on Azure App Service

查看:126
本文介绍了如何在Azure App Service上运行django manage.py命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中对azure应用服务执行Django migrate命令,

I would like to execute Django migrate command on azure app service in my application,

$ python manage.py migrate

但我不知道该怎么做。

推荐答案

通常情况下,我们利用虚拟环境来处理python脚本作为官方指南显示。如果是这样,如果我们使用Azure Python运行时由于缺乏依赖关系而运行命令,则可能引发异常。

As common scenario, we leverage virtual environment to handler python scripts as the official guide shows. If so, it may raise exceptions if we use the Azure Python runtime to run the commands because of lacking of dependencies.

通常,我们可以利用您的Web的Kudu Console站点应用程序或Visual Studio Online扩展程序来修改脚本或执行命令。

Usually, we can leverage Kudu Console site of your Web Apps or Visual Studio Online extension to modifying scripts or executing commands.


  1. 您可以登录其URL为的Kudu控制台网站https://< your_web_app_name> .scm.azurewebsites.net / DebugConsole

  2. cd d:\home\site\wwwroot 这是您的应用程序的根目录。

  3. 运行命令 env\Scripts\python.exe manage.py migrate (假设您的虚拟环境为<$ c $根目录中的c> env

  1. You can login the Kudu Console site whose url is https://<your_web_app_name>.scm.azurewebsites.net/DebugConsole
  2. cd to d:\home\site\wwwroot which is the root directory of your application.
  3. run the command env\Scripts\python.exe manage.py migrate (assume your virtual environment is env in the root directory)



Visual Studio Online扩展名:



Visual Studio Online extension:


  1. 安装VSO扩展,可以参考如何在应用程序服务上安装作曲家

  2. 登录VSO编辑器网站,找到打开控制台按钮打开命令的cmdlet,您可以在左侧导航栏中找到此按钮。 < img src =https://i.stack.imgur.com/aVLzx.pngalt =在此输入图像说明>

  1. Install VSO extensio, you can refer the answer of How to install composer on app service?
  2. Login VSO editor site, find the open console button to open the cmdlet for commands, you can find this button in the left navigation bar.

任何进一步的关注,请随时让我知道。

Any further concern, please feel free to let me know.

这篇关于如何在Azure App Service上运行django manage.py命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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