Skip to content

Migrating My Blog to a New Platform: From Django on Digital Ocean to GitHub Pages with MkDocs 🚀

As a developer and indie hacker, I’m always on the lookout for ways to optimize both my workflow and my expenses. Running my blog on Digital Ocean with Django was a great learning experience, but as my needs evolved, I realized that it wasn’t the most cost-effective or flexible solution for what I wanted in the long term. 👨‍💻

So, I decided to migrate my blog to a new platform—one that would reduce costs, simplify maintenance, and give me more flexibility in managing content. After some research, I found that hosting a static site using GitHub Pages and MkDocs, specifically with the Material for MkDocs theme, was the perfect fit. Here’s how and why I made the switch.

Why the Migration?

Cost Efficiency 🤑

Running a Django application on Digital Ocean, while robust, wasn’t the most cost-effective solution for a simple blog. The VPS (Virtual Private Server) cost, along with the need to manage the server, database, and Django updates, added up. For a personal blog that didn’t require complex backend functionality, this setup was overkill.

Simplicity and Maintenance 🧘

Maintaining a Django application means dealing with dependencies, security updates, and potential downtime during deployments. While this is manageable, it’s not ideal for a blog where I want to focus more on content creation and less on technical overhead.

Flexibility and Speed ⏩

GitHub Pages offers a seamless way to deploy static sites directly from a GitHub repository. By using MkDocs, I could leverage Markdown for writing posts, making the process much more streamlined. The Material for MkDocs theme provided a professional look with minimal configuration, and being a static site, the blog now loads faster and is easier to manage.

The Migration Process 🚀

Step 1: Setting Up MkDocs

First, I installed MkDocs and the Material for MkDocs theme. This setup is simple, requiring just a few commands:

pip install mkdocs
pip install mkdocs-material

With MkDocs, my content is written in Markdown, which is a lightweight and easy-to-use format. This change alone simplified my workflow significantly.

Step 2: Creating the Blog Structure 🏗️

I structured the blog using folders for posts and images, and I customized the layout by tweaking the mkdocs.yml configuration file. The new structure made it easy to manage content and keep everything organized.

Step 3: Migrating Content 🕊️

Migrating the content from Django to MkDocs was straightforward. I converted my existing blog posts to Markdown format and placed them in the appropriate directories within the new MkDocs project. For images and other static files, I simply moved them to the docs folder.

Step 4: Deploying to GitHub Pages 🧑‍🚀

Deploying the blog to GitHub Pages was the most satisfying part of the process. After setting up my MkDocs configuration, I used the command:

mkdocs gh-deploy

This command builds the site and pushes it to the gh-pages branch of my GitHub repository. The site is then automatically hosted on GitHub Pages, with no additional cost and minimal maintenance.

The Results 📈

The migration has resulted in a blog that is faster, easier to manage, and significantly cheaper to maintain. The GitHub Pages and MkDocs setup provides all the flexibility I need, with the added benefit of being version-controlled, thanks to GitHub.

I now spend less time worrying about server maintenance and more time focusing on writing and sharing my thoughts. Plus, the static nature of the site has improved loading times, providing a better experience for my readers.

Conclusion ✏️

Migrating my blog from Django on Digital Ocean to GitHub Pages with MkDocs was one of the best decisions I’ve made for this project. It’s a great example of finding the right tool for the job—sometimes, simpler is better. If you’re running a blog or any content-focused site and want a cost-effective, low-maintenance solution, I highly recommend considering GitHub Pages and MkDocs.