What is your experience with development to production workflows. What is the preferred method to make changes to a working Django site? What tools do you use to update your site? I’ll be putting a project on my ISP shortly but I want to make sure that I am able to maintain the site with a proper workflow. Do you guy’s push from GitHub or maintain a completely separate dev environment and push from that? Maybe I just kill the server and make changes locally and restart. That seems like a horrible idea.
I would greatly appreciate your thoughts and experiences especially those from experienced programmers regarding what tools you use and your workflow.
Thanks in advance.
That’s a good question. I believe the best answer is going to be “it depends”. For example, if you don’t plan on making many updates, having a more manual process for deployments may be sufficient. But if you’re doing it multiple times per day, then automation becomes more important.
If I’m building something for a client that I’m going to hand-off in the future, I prefer to setup CI and CD with Heroku and GitHub actions. Heroku manages so much out of the box that it’s valuable to me as a freelance developer. It manages a bunch of the DevOps work that I’d otherwise have to spend time building, automating and maintaining. Depending on the project, I’ll use the Whitenoise library to manage the static files otherwise I’ll upload them to S3/Cloudfront. Then there’s database backups, error tracking, performance monitoring, logs and system downtime alerts that need to be considered.
Keep in mind, this is only one person. I can’t speak towards many other developers and I wouldn’t say that everyone should do the same as me. This setup tends to fit my needs and allows me to work efficiently.
Absolutely agree with @CodenameTim’s answer, but I’ll chime in with a little of what we do just to add another perspective.
We have two different methods. One is just a git pull from the repo and copy into the target directory, followed by
collectstatic commands. The other is a docker-compose with the context set to the target system. (There’s some other stuff mixed in as well, but that’s the basic idea.) It’s still mostly a manual process, but we’re working to automate it.
We don’t use GitHub, we have a private GitLab server used as our repository.
It’s not horrible, depending upon the site. I’ve got some very trivial projects maintained that way. I don’t recommend that as a general rule, but there are always exceptions.