Django Blog

Posted by: Chris Sept. 13, 2020, 5:57 p.m. |


  • Language
    • Python
  • Framework
    • Django
    • Mezzanine CMS
    • Bootstrap
  • Web
    • CSS
    • HTML
    • Nginx
    • Gunicorn
  • Database
    • Postgres

Brief Description

 Repo Link

I used to have a blog hosted on Wordpress, where I wrote about birds. I noticed it would get expensive if I wanted a full blog with all the bells and whistles I desired. So, I decided to instead make my own blog using Django and Mezzanine. I also have much more freedoms with what I can do in the blog, since I am writing the code myself.

This Django blog has content managed by the Mezzanine CMS. Mezzanine has a very nice administrative view that is easily customizable. The default templates that come with Mezzanine are also extremely convenient, because a lot of the work is done for you.


Before I chose Mezzanine, I had tried making my own Django blog without a CMS. I was making my own blog post models, page templates and views. Then I found that Mezzanine had done all these things for you, and in a much nicer way. For instance, the blog post model supplied by Mezzanine has a ton of extra attributes I would not have added. 

Web Framework

When I initially looked into making my own blog, I took some time to look through all the frameworks. I am much more comfortable with the Python language, so naturally I narrowed the search down to Django or Flask. Django seemed to have more to offer, which I liked. It took some time getting to know the Django system, but eventually I got used to it. 

Django's template system is a really nice way of generating html pages using Pythonic code. The templates makes it easy to present several pages with different data. When I was first writing my Django blog without a CMS, I had a front page using the same Bootstrap theme. I enjoyed the look of it, so I kept using it.

Figure 1: What my front page looked like before Mezzanine.


I never learned how to properly deploy a project with my initial Django blog, but making a blog with Mezzanine helped me. Mezzanine comes with a Fabric file that sets up the server configurations for you. The fabric file is all that is required to set up the server which your project will live in.

The Nginx web server was setup by the fabric file, but there were still some configurations the fabric file could not set up properly, for some reason. So, I had to go in myself and edit the server blocks inside the Nginx configuration files. The media was not being served correctly, and I updated the configurations to correctly load the media files.

Then the Postgres database had to be deployed as well, but again the fabric file took care of that. The database did not go without issues, either. I had trouble migrating some models, so I had to manually enter the database and create the columns inside the troubled table. Then everything was working as intended.

Further Improvements

There are some things I do not like about my site at the moment. I do not currently have a newsletter implemented, but I would like to update users on new posts. I am thinking I may use Sendgrid or some kind of Django newsletter package. I still have to test it out in my local environment.

Currently, some images go beyond the <div> containers, which makes the site look kinda lame. I have tried figuring it out, but can't find a way to properly center images when they're bigger than the parent container. Eventually I may figure it out, and all this will be a bad dream.