Create a Digital Ocean Server

You may now have your DjangoMango project on your local machine. But you need to get access to a server to host your project files so that others can see your work. So let's get started.

The first step towards setting up your deployment environment will be to get access to a server so you can host and serve your project files. There's not much point having a great Django application if no one can use it right? And so to do that, you will want to first get yourself a Digital Ocean account. If you haven't yet signed up, we would really appreciate you using our referral link. You'll get $100 credit as soon as you add a valid payment method to your account, and you'll be helping support our efforts too.

Note that you may also reference the Digital Ocean guide for these steps.

Create your Droplet

Digital Ocean refers to their cloud servers as 'droplets'. And this is what you will be installing and running your Django application on. So to get started, access your Digital Ocean dashboard, and find the 'Create > Droplet' option. You'll be presented with an array of options, which we will work through step-by-step below.

Choose an Image

First, you'll need to pick the image you want to install on your droplet. If you would like to take advantage of our Docker configuration, then we would recommend you pick Digital Ocean's pre-configured Docker image. Which can be found via their marketplace.

This droplet is actually built on Ubuntu, but it'll come installed with Docker and docker-compose from the get-go.

Choose a Plan

Next, you need to select what size droplet you would like. They come in all shapes and sizes, and the type of droplet you should go for will ultimately depend on your application type and use-case.

In general however, Digital Ocean's 'Shared CPU/ Basic' droplet with 1 vCPU and 2GB of memory should be more than sufficient for most small to even medium sized web apps. You may even get away with a 1 vCPU / 1 GB droplet if you are only looking to run a static blog or site. Either way, don't forget, you'll easily be able to scale up to the next tiered droplet as your web application grows in popularity.

Choose a Region

One of the benefits of cloud-based hosting with a host like Digital Ocean is that you can provision your resources almost anywhere across the globe.

It's not going to have a significant performance impact, but do try pick the region closest to your majority user-base. And more importantly, take note of your selected region. As you may look to create additional resources later on and locating them in the same region will provide benefits.

Additional Options

You have a few additional options for your droplet in the next section. Here, let's enable monitoring so we can take advantage of Digital Ocean's metric collection and monitoring functions. But we can leave IPv6 and User data as disabled.

Authentication

Next, you need to either create a root password or SSH key to access your droplet. We highly recommend you create a key for the additional security. To do so, you can follow Digital Ocean's instructions on the right of the screen. And once set up, you can make use of PuTTY if you are on Windows or OpenSSH if you prefer to use terminal, or are on Linux or MacOS.

Enabling Backups

You are almost ready to finalize and build your droplet. But before doing so, you'll need to decide if you want to enable backups of your droplet's file system. The choice is yours of course, but in our opinion, you'll only need to enable droplet backups if you do not intend on creating a separate managed database.

It's important to understand that if you do not create and run a separate managed database, all of your application data will be created and stored on our pre-configured Docker database image, which will reside on your droplet alongside your application. If something happens to your droplet and you don't have a backup you will also lose all of your application data.

Alternatively, if you do create a separate Digital Ocean Managed Database, all of your applications data will be on a separate server which will have it's own regular backup. And while your actual Django application files may still be at risk, these should be read-only from the perspective of the server. So you should be in a position to quickly and easily get a fresh set of your project files back on the droplet, and get back up and running again.