如何运行在Azure应用服务Django的manage.py命令 [英] How to run django manage.py command on Azure App Service
问题描述
我想执行的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在线扩展捻控制台网站修改脚本或执行命令。
捻控制台网站:
- 您可以登录其网址是捻控制台站点
https://开头&LT; your_web_app_name&GT; .scm.azurewebsites.net / DebugConsole
- <大骨节病> CD 骨节病>到
D:\\家\\网站\\ wwwroot文件
这是应用程序的根目录。 - 运行命令
ENV \\脚本\\ python.exe manage.py迁移
(假设你的虚拟环境是ENV
在根目录)
Visual Studio的联机扩展:
- 登录VSO编辑的网站,找到
打开控制台
键打开命令该cmdlet,您可以在左侧导航栏中此按钮。的
安装VSO extensio,你可以参考答案href=\"http://stackoverflow.com/questions/35035504/how-to-install-composer-on-app-service\">如何安装作曲家应用服务?
任何进一步的关注,请随时告诉我。
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:
- You can login the Kudu Console site whose url is
https://<your_web_app_name>.scm.azurewebsites.net/DebugConsole
- cd to
d:\home\site\wwwroot
which is the root directory of your application. - run the command
env\Scripts\python.exe manage.py migrate
(assume your virtual environment isenv
in the root directory)
Visual Studio Online extension:
- Install VSO extensio, you can refer the answer of How to install composer on app service?
- 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屋!