如何运行在Azure应用服务Django的manage.py命令 [英] How to run django manage.py command on Azure App Service

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

问题描述

我想执行的Django迁移到Azure上的应用程序服务命令,在我的应用程序,

  $蟒蛇manage.py迁移

但我不知道如何做到这一点。


解决方案

作为常见的情况,我们利用虚拟环境中处理程序Python脚本作为<一个href=\"https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/\"相对=nofollow>官方指南节目。如果是这样,如果我们使用Azure的Python运行时运行,因为缺乏相关性的命令,它可能会引发异常。

一般情况下,我们可以利用你的Web应用程序或Visual Studio在线扩展捻控制台网站修改脚本或执行命令。

捻控制台网站:


  1. 您可以登录其网址是捻控制台站点 https://开头&LT; your_web_app_name&GT; .scm.azurewebsites.net / DebugConsole

  2. <大骨节病> CD D:\\家\\网站\\ wwwroot文件这是应用程序的根目录。

  3. 运行命令 ENV \\脚本\\ python.exe manage.py迁移(假设你的虚拟环境是 ENV 在根目录)

Visual Studio的联机扩展:


    安装VSO extensio,你可以参考答案href=\"http://stackoverflow.com/questions/35035504/how-to-install-composer-on-app-service\">如何安装作曲家应用服务?
  1. 登录VSO编辑的网站,找到打开控制台键打开命令该cmdlet,您可以在左侧导航栏中此按钮。的

任何进一步的关注,请随时告诉我。

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

$ python manage.py migrate

but I have no idea how to do this.

解决方案

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.

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

Kudu Console site:

  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 extension:

  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应用服务Django的manage.py命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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