How to build Django project?

I just want to build a Django project, and if it succeeds then only I want to run on the server.
I am doing this for continuous deployment. If a build fails then I don’t want to release it.

Here is how we are doing (an approximation of) CD:

We use GitLab for hosting and managing the project repository. GitLab provides a feature for running jobs/pipelines on certain conditions, usually when merging branches. Other repository hosts such as GitHub and BitBucket provide similar features, afaik. This feature is useful for doing (an approximation of) Continuous Integration and can also be used in parts for CD. We found it necessary for the job run by the pipeline to essentially just call an Ansible playbook, which in turn does the actual deployment. But the principle applies all the same, I think. This has the advantage that the pipeline can be set up to fail when tests fails (or some other “build” condition) and nothing will be deployed.

1 Like