Create a Digital Ocean Server

Your DjangoMango project is running on your local machine for development. But now it's time to get access to a remote server so that others can see your work in production.

The first step towards setting up your deployment environment will be to provision and access a remote server so you can host and serve your application files. And to do that, you'll want to get yourself a DigitalOcean account.

If you haven't yet signed up to DigitalOcean, we would 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 DigitalOcean guide for these steps.

Create your Droplet

DigitalOcean 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 DigitalOcean dashboard and find the 'Create > Droplet' option. You'll be presented with a set 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 want to take advantage of the Docker configurations we ship with our products, then we recommend you pick DigitalOcean's pre-configured Docker image. Which can be found via their marketplace.

Note that the above droplet is actually built on Ubuntu 20.04, but it'll come installed with Docker 19.03.12 and docker-compose 1.27.0 from the get-go per the official Docker recommendations.

Choose a Plan

Next, you'll need to select what droplet size you would like. Droplets come in all shapes and sizes, and the one you should go for will ultimately depend on your application type and use-case. A dynamic content application which serves a great deal of traffic will want a well provisioned and dedicated server. While a small app which generally serves static content (such as a blog), will run fine on a shared server with minimal resources.

If you aren't sure, then we recommend DigitalOcean's 'Shared CPU/ Basic' droplet with 1 vCPU and 2GB of memory. That droplet should be more than sufficient for most small to medium sized web applications built on Django. Or, you may even get away with a 1 vCPU / 1 GB droplet if you're simply looking to run a personal blog.

You'll easily be able to scale up to the next tiered droplet as your web application grows. But there are some restrictions on scaling down tiers. Particularly with respect to disk space allocations.

Choose a Region

One of the benefits of cloud-based hosting, is that you can provision your resources almost anywhere across the globe. And DigitalOcean is no different.

If you're running a simple application which is light on content and media, then your choice here may not have a significant impact on performance. But either way, try to pick the region closest to your majority user-base and/or your own location.

Keep in mind, you do have the option to create a managed Storage Space on DigitalOcean, which will allow you to replicate and serve your application files via a global Content Delivery Network (CDN). That way, your users will be able to retrieve your app files, particularly large media files, from a CDN server nearest to their own location rather than your droplet location.

Take note of your selected droplet region. If you create additional resources later on, such as a managed database, then locating them in the same region will provide some set up 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 DigitalOcean's instructions on the right of the screen.

Once set up, you can make use of PuTTY to access your droplet if you are on Windows, or OpenSSH if you prefer to use terminal via Linux or MacOS.

Enabling Backups

You're almost ready to finalize and build your droplet. But you'll first need to decide whether 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 don't intend on creating a separate managed database.

Why you may ask? Well, it's important to understand that if you don't run a separate managed database, all of your application data will be created and stored via our pre-configured Docker database image which will actually reside on your droplet disk. So 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 Managed Database on DigitalOcean, all of your application data will be on a separate dedicated 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 droplet. 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.

Create the Droplet

And that's it. You're now ready to create your new droplet via the Create Droplet button at the bottom of the page.

Last updated