Django vs WordPress
Django and Wordpress are completely different technologies. Yet I find a lot of people are curious about switching over to Django. This post aims to explain why and when you should switch from Wordpress to Django.
WordPress has been around for a very long time. A couple of years ago it dominated the market as one of the best choices for building a website. A lot of developers started their careers by first learning how to build websites with WordPress. From there they would learn the basics of HTML, CSS, and most likely Php - because that's what WordPress is built in.
My first business website was also built with WordPress! However, I didn't invest time in learning how to use WordPress. Instead, I paid a freelance company that built and hosted the website for me.
For context, that website sold Calculus questions and answers for University students. The answers were handwritten and I would scan and upload a photo of each question to the website. Each booklet would have about 300 pages which would take a couple of hours to upload. This eventually would be the reason why I moved off of WordPress. But more on this later!
WordPress is a Content Management System (CMS). A CMS is a software that allows you to focus on the content of your website. You can create new pages of your website and organise the menu items in your navigation bar to point to those pages. Most of the time the content is in the form of blog posts or general web pages with information. The point of using a CMS is so that you don't have to worry about the underlying software and so that you can focus on writing the content.
A lot of developers make a career of building WordPress websites. There's absolutely nothing wrong with that. In fact, a lot of companies don't need anything more than a simple website built using a CMS.
This is a shortlist of the pros of using WordPress:
- It's quick to set up and launch a website
- It requires very little understanding of HTML and CSS
- It's very easy to use
- Simple functionality for adding users that have permission to be authors or administrators on your site
- It has built-in features for SEO
These pros make a very compelling argument for why you should use a CMS. But of course, this is only useful for simple and standard websites like landing pages and blogs. As soon as you want to do more complex things, WordPress might not be the best solution.
So what is an example of a complex thing?
- API integrations
- Specific user permissions
- Automation and scripting
- Background tasks
It's worth noting that depending on your use-case, you might still be able to achieve your goal in WordPress using plugins and 3rd party apps. This requires you to develop a thorough understanding of the WordPress ecosystem. But the more flexible and customised the solution is, the more difficult it will be to build it in WordPress.
If you need complete control of your website, Django is the better option.
Coming back to that website I had.
I would spend hours every week uploading images to the site. At the time I was learning Django and knew that there was a better way to automate the uploading of all of the images. Eventually, I wrote a custom Django command that would loop through the images in a folder and upload them to my Django site in a matter of seconds. This productivity boost made it a no-brainer for me to switch from WordPress to Django.
But this wasn't the only benefit. The site required users to have specific permissions that determined the level of control they had on the site. Permissions such as being an administrator, being an author allowed to upload images, and being a general user that can purchase the books. Using Django's built-in permissions you can easily set what a user is allowed to do. You can also customise the user model to have your own logic if need be.
Once I'd moved over to Django, the benefits of having full control were very clear. I could build views that had any data I wanted. I could integrate with all kinds of 3rd party APIs. And ultimately I learned how to use Django, which in itself is a new skill.
Django and WordPress are very different technologies. WordPress gives you a set of features that help you bootstrap a blog or landing page very quickly. It's great because you don't have to worry about code (most of the time). Django, on the other hand, is great for projects that require much more control.
To answer this question you need to be clear on what your goal is. Do you just want to get a website up and running as quickly as possible? If so, use WordPress.
Do you need finer control and flexibility? If so, use Django. That being said, there is a learning curve associated with using Django. You will need a good understanding of Python and web development principles before diving into Django. You can watch this video on how much Python you need to know before starting with Django.
WordPress is not the only CMS out there. It is, however, a very popular choice. There are some great CMS projects built using Django. Django CMS and Wagtail are two very well-known projects that you can use not only for CMS functionality but also as additions to your Django projects.