Deploying Early. Earlier Than You Think.
You wouldn’t expect to write your Django app perfectly on the first try.
There are things you only find out once you are trying to implement them Sometimes getting it right, means rethinking the details and trying different approaches until you find a way which works for you.
Getting deployment right is really similar to the process of developing your app. Deployment shouldn’t be an afterthought - in fact you are better off if you start thinking about it early, starting with relaxed constraints and approaching the task iteratively.
As simple as possible
You don’t need to deploy the most complex version of your app right away.
Remember when your project was just one step ahead of a glorified “Hello World” app? This was the best time to start thinking about deployment.
At this point, your application is really simple and easy to handle. You haven’t had time to customize it a lot, and can get something basic working with the help of one or two good tutorials.
It’s also not a big deal how you start. Your app should not care where you’re deploying it to, but you should be thinking of deployment from the early stages of the project.
Just make sure to get something working in a way which is comfortable for you, and to restrict access to your freshly deployed app until it’s mature enough for public traffic.
Why start in production?
You don’t need to deploy to production right away. A “private” deployment of your app - maybe on a VM or inside of a container on your development machine is a good first step!
Aim to find a way to get a server-like environment going, which you can destroy and recreate from scratch without much effort. It’s okay to approach deployments in an iterative manner - start with a deployed environment which only slightly differs from your development stack (once again, make sure to keep it away from public access).
Then you can continue working on developing your app, and improve the way you’re deploying it bit by bit. Small changes to a working system are way easier to introduce than building a huge one from scratch.
Also, you can let the “need to deploy” will help you make well-informed tech choices while you’re building your app. It’s a win-win all around.
If it hurts, do it more often
Frequency reduces difficulty. If you know that deployment might be a challenging task for you, you should give yourself time to ease into it.
If deployment seems like a complicated thing, why not start in a simplified setting, and do it early on? Starting to deploy early, and doing it a few times before “showtime” is a great way to prepare and learn.
An easy way to get started
So, how can you start deploying early? How to get your hands on a deployment environment which is easy to clean up and recreate?
Virtual machines and containers are great tools to work on your deployment game. They offer an easy to spin up a private server-like environment at any time, without costing you any money, right on your machine.
You can create a Dockerfile and a docker-compose stack for this, or use Vagrant with Ansible as an alternative. Aim for creating a deployment playground at first - once it works, you can transform it into an automated blueprint for deploying your application to production step by step.
Want to learn more about using Docker or Vagrant to prototype a deployment environment for your Django app, and beat the deployment learning curve? Enter your email below, and I’ll let you know once there are new articles on the topic!