简体   繁体   English

在VSTS中为Django应用构建定义

[英]Build definition for Django app in VSTS

I'm looking for a functional build definition for a Django 2.0.5 app in Visual Studio Team Services. 我在Visual Studio Team Services中寻找Django 2.0.5应用程序的功能构建定义。

What I'm trying to do is deploying my Django application to Azure App Services trough CI/CD, and the process is running well (I mean, the files is being traspased to production), but, for some reason, my app doesn't starts and I'm getting a lot of errors. 我想做的是通过CI / CD将Django应用程序部署到Azure App Services,并且该过程运行良好(我的意思是,文件正被传输到生产环境中),但是由于某种原因,我的应用程序没有运行。 t开始,并且出现很多错误。 I guess I'm traspassing the wrong files, but I really don't know it. 我猜我正在传递错误的文件,但我真的不知道。

Can someone please tell me what did you do to build a Django app with CI/CD in VSTS? 有人可以告诉我您如何在VSTS中使用CI / CD构建Django应用程序吗?

EDIT: What I'm doing is use a default build definition for Python called "Python package", but customized. 编辑:我正在做的是为Python使用默认的构建定义,称为“ Python包”,但已自定义。 In one of the build steps, it calls to "setup.py" file. 在构建步骤之一中,它调用“ setup.py”文件。 I created the file in the root folder of my repository, and I wrote the next code: 我在存储库的根文件夹中创建了该文件,然后编写了以下代码:

import os
import shutil
from distutils.dir_util import copy_tree

if not (os.path.exists('./dist')):
    os.makedirs('dist')
else:
    shutil.rmtree('./dist')

copy_tree(".", "./dist")

Ok, I know the code is ugly, and I need to write it in a better way, but is functional and it copy the entire project structure into the "./dist" directory. 好的,我知道代码很丑陋,我需要以一种更好的方式编写它,但是它是有功能的,它将整个项目结构复制到“ ./dist”目录中。 Later, the release proccess takes all these files and copy it to production environment. 稍后,发布过程将获取所有这些文件并将其复制到生产环境。 All this works Ok, but my app never starts. 所有这些都可以,但是我的应用程序从未启动。 When I try to navigate my url, I receive a 404 error, and can't use any of the project routes. 当我尝试浏览URL时,出现404错误,并且无法使用任何项目路线。

Hope it helps, if not, I will put all the necessary details, thank's again. 希望对您有所帮助,如果没有,我将提出所有必要的细节,再次感谢。

Finally I found the problem. 终于我找到了问题。 I didn't traspased the environment folder, and I has missed web.config file too. 我没有处理环境文件夹,我也错过了web.config文件。

Uploading the env folder and the web.config file fix the application. 上载env文件夹和web.config文件可修复该应用程序。

ref: https://github.com/azureappserviceoss/djangoapp 参考: https : //github.com/azureappserviceoss/djangoapp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM