How To Deploy Your Django App With Michman
Tags: django, deployment, python, tutorial
Published: 2023-01-03 19:41:19

It is good to know how to deploy and maintain your apps yourself, but it may be a lot to learn to begin with and a pain to maintain in the long run.

That's why services like [Michman](https://michman.dev/) exist. They provide an abstraction layer between you and your servers by automating provisioning, deployment and maintenance with an easy to use UI to manage your infrastructure.

Michman takes care of keeping your server secure and up to date, deploying and configuring your apps, setting up HTTPS/SSL certificates, managing background tasks, databases, caches and other software, so you can focus on what you love the most - developing your amazing application.

### 0. Put your project on GitHub

If your project isn't on [GitHub](https://github.com) yet - you should definitely put it there.

Most deployment services including Michman are designed to take the source code of your project from a Git storage, like GitHub. It is free and you can keep your GitHub repo private if your project is not open-source.

### 1. Sign up on Michman

![Sign up for a free trial on michman.dev](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yzh61d5d6gvb6fzgmzwr.png)

[Register with a free 30-day trial on Michman](https://app.michman.dev/register) to get going.

Michman offers a generous 30-day trial and even provides a moneyback guarantee after that, so you can try it with no risk at all.

### 2. Sign up on DigitalOcean

Michman uses [DigitalOcean](https://cloud.digitalocean.com/registrations/new) infrastructure to deploy your apps, so you need an account there to get going. Go ahead and sign up if you don't have an account there yet. [Create an account on DigitalOcean](https://cloud.digitalocean.com/registrations/new)

### 3. Configure DigitalOcean API access

![Server provider connection form on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb28fpjbcluw183cv7pz.png)

Go to your [API Tokens page on DigitalOcean](https://cloud.digitalocean.com/account/api/tokens) and create a new API token for Michman. Copy-paste it into [Michman Server Providers page](https://app.michman.dev/account/providers) to add your DigitalOcean account as a server provider on Michman.

### 4. Connect your GitHub account with Michman

![Git provider connection form on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2la51040ujffz02ycjxb.png)

Michman takes your source code from your GitHub repo, which can be either private or public.

Connecting your GitHub account to Michman is as simple as pressing one button. In Michman go to your [Source Control page](https://app.michman.dev/account/vcs) and press Connect to GitHub. Then just confirm the connection in a page that opens automatically.

### 5. Create a new server for your app

![Server creation on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpq1hnai7hyqpy5jqdaq.png)

Now with everything set up you can start creating servers! It takes about 30 seconds to create a server and then Michman will configure and secure it for you automatically.

Go to the [Servers Page](https://app.michman.dev/servers) on Michman, choose DigitalOcean as a server provider and fill in your server details:

1. Give your server a descriptive name or stick with a generated one.
2. Select type "App Server" for a server with everything needed to run a Django app in one package.
3. Select server size you want to use - for a starter you should go with at least 1024 Mb of RAM to run your Django app and everything needed to serve it - web server, database, cache, etc.
4. Choose the version of Python that your app requires to run. Go with the latest you're confident with.
5. Press **Create Server**.

At this point Michman will take care of everything - request a server from DigitalOcean, set up users, secure access, update software and install everything needed to run your app. The process takes about 10 min.

### 6. Create a project on Michman

![Project creation on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c5w78kq1sga7ajrnbqub.png)

As soon as your server is configured you can go ahead and [Add Your Project](https://app.michman.dev/servers) to Michman. Choose your newly created server and fill in the details of your projects:

1. Type a domain you have to run your project on.
2. Choose Django as the project type. This will tailor the setup for Django. Flask and just generic Python are also available.
3. Here you can create a database for your project right away - type a DB name, username and password for it. Don't forget to store that password somewhere safe!
4. Press **Create Project**. It will be created immediately, you can see it in the list below.

### 7. Configure DNS for your domain.

Go to your domain provider page and point your domain to the IP address of your server.

### 8. Deploy your app on the server

Now it's time to install and deploy your project.

Open the project's page and configure the repo to use:

1. Choose **GitHub** as your VCS provider.
2. Type the full name of the repository with your project like so: `username/repo_name`
3. Type the name of the branch to use for deployment. Most likely `main` or `master`
4. Type the path to the public assets directory of your projects, which is just `static` for default Django projects.
5. We recommend using a Deploy Key, which you need to copy from this page and add to your repo in GitHub in the repository settings before proceeding. You can also uncheck this tick and Michman will add a global access key to your GitHub account on its own, although this way is a bit less secure when you're running multiple projects.
6. Press Install Repository and Michman will configure the server for your project and copy sources from your repo.
7. If you app uses `.env` configuration file, which we highly recommend, go to Configuration page of your project and make sure the `.env` file contains everything your project needs to run. Check out other configuration options on this page as well, although default ones will likely be fine for a start.
8. The project is not deployed yet, though. It isn't available for your users. For this to happen you just have to press **Deploy Now** button to run a manual deployment.

![Project deployment on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13t987fnnzddhwp7i7nx.png)

Voilà! Your project is deployed and accessible to users.

### 9. Configure HTTPS/SSL

![One-button HTTPS setup on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7kf803zgbqq6r9vpe6mw.png)

To make it more secure for your users you want your project to be served over HTTPS/SSL.

Go to your server's page on Michman and open SSL section. Type the domain name you have and press **Request Certificate**. 

Michman will get a free industry-standard certificate from Let's Encrypt and setup automatic renewals for you.

Note that your domain must already be pointed at your server with a DNS record. Otherwise Let's Encrypt will fail to verify that the domain actually belongs to this server.

Michman will configure HTTPS for your project automatically from this point.

### 10. Automate future deployments

![Automatic deployment on Michman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/not8u8u2cp3oqsngnvrq.png)

Michman has an automatic deployment feature called **Quick Deploy**. You can enable it on your project's page. Any time you push a change to the branch chosen for deployment in your GitHub repo Michman will take this most recent version of your code and deploy it on your server.

---

Read more in details about all the features in the official Michman documentation: [docs.michman.dev](https://docs.michman.dev/)

![Michman documentation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w26pge8agouau1to9do3.png)