DEV Community

Cover image for How To Deploy Your Django App With Michman
Bogdan Kondratov for Michman

Posted on

How To Deploy Your Django App With Michman

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 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 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

Register with a free 30-day trial on Michman 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 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

3. Configure DigitalOcean API access

Server provider connection form on Michman

Go to your API Tokens page on DigitalOcean and create a new API token for Michman. Copy-paste it into Michman Server Providers page to add your DigitalOcean account as a server provider on Michman.

4. Connect your GitHub account with Michman

Git provider connection form on Michman

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 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

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 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

As soon as your server is configured you can go ahead and Add Your Project 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

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

9. Configure HTTPS/SSL

One-button HTTPS setup on Michman

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

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

Michman documentation

Top comments (0)