开发者

Rebuilding a Django site every night

开发者 https://www.devze.com 2023-03-23 05:51 出处:网络
I have a django site that needs to be rebuilt every night. I would like to check out the code from the Git repo and then begin doing the stuff like setting up the virtual environment, downloading the

I have a django site that needs to be rebuilt every night. I would like to check out the code from the Git repo and then begin doing the stuff like setting up the virtual environment, downloading the packages, etc. This would have no manual intervention as this would be run from cron

I'm really confused as to what to use for this. Should I write a Python script or a Shell script? Are there any tools that assist in this?

Thanks.


So what I'm looking for is CI and from what I've seen I'll probably end up using Jenkins or Buildbot for it. I've found the docs to be rather cryptic for someone who's never attempted anything like this before.

Do all CI like Buildbot/Jenkins simply run tests and more test开发者_Python百科 and send you reports or do they actually set up a working Django environment that you can access through your browser?


You'll need to create some sort of build script that does everything but the GIT checkout. I've never used any Python build tools, but perhaps something like: http://www.scons.org/.

Once you've created a script you can use Jenkins to schedule a nightly build and report success/failure: http://jenkins-ci.org/. Jenkins will know how to checkout your code and then you can have it run your script.


There are litterally 100's of different tools to do this. You can write python scripts to be run from cron, you can write shell scripts, you can use one of the 100's of different build tools.

Most python/django shops would likely recommend Fabric. This really is a matter of you running through and making sure you understand everything that needs to be done and how to script it. Do you need to run a test suite before you deploy to ensure it doesn't really break everything? Do you need to run South database migrations? You really need to think about what needs to be done and then you just write a fabric script to do those things.

None of this even touches the fact that overall what you're asking for is continuous integration which itself has a whole slew of tools to help manage that.


What you are asking for is Continuous Integration.

There are many CI tools out there, but in the end it boils down to your personal preferences (like always, hopefully) and which one just works for you.

The Django project itself uses buildbot.

If you would ask me, then I would recommend you continuous.io, which works ouf the box with Django applications. You can manually set how many times you would like to build your Django project, which is great.

You can, of course, write a shell script which rebuilds your Django project via cron, but you should deserve better than that.

0

精彩评论

暂无评论...
验证码 换一张
取 消