DEV Community

Justin Dang
Justin Dang

Posted on

Help with designing a CMS

Hey there! I want to build a content management system/blogging engine with Flask as a side project and I aim to migrate my blog (currently hosted on Ghost) to it when it's done.

I'm currently a student with some experience working with python and web. But I'm not so confident with how to design this system. (E.g. what API is needed, how to build a secure system? should I use an ORM? A frontend framework?)

If anyone have more experience in this area please give me some pointers so I don't start off on the wrong foot. Thanks! :)

Top comments (13)

Collapse
 
listnux profile image
ListNUX • Edited

It much depends on what exactly you want to do. You can build a simple blogging engine with Flask and Flask-FlatPages, that takes posts in Markdown and generates the HTML. You can generate static pages with Frozen-Flask.

And then you can add as much complexity as you want. If you want a CRUD app, for login, comments, etc, you can use raw SQL, or SQLAlchemy.

I suggest you have a look here: blog.miguelgrinberg.com/post/the-f..., it's a very thorough step-by-step guide that builds a simple blogging engine with Flask. It can give you ideas on how to plan out your CMS, as well. Hope it helps.

Collapse
 
justinhtdang profile image
Justin Dang

Hey thanks for the advice! I'll definitely checkout Miguel blog.

Collapse
 
listnux profile image
ListNUX

Good luck. I have a few sites running with Flask and Frozen-Flask as a static generator, please feel free to ask if there is anything I can help with.

Thread Thread
 
justinhtdang profile image
Justin Dang

Thanks for the offer! I'll definitely let you know :)

Collapse
 
begrafx profile image
BEGRAFX

I suppose the first, biggest question to ask here would be, "Why?" Why create a CMS/Blog engine? There are already several out there. Is there a reason to "Reinvent the wheel"? Perhaps you have an idea... something that Drupal or WordPress or others haven't done, or could do better? Would it make more sense to create a module/plugin for an existing CMS? Perhaps this is just to gain experience. That's great. But you talk about running your own site on this. Realize that it may be some time before your project is ready to meet the world. Don't get me wrong. I'm not saying "Don't"; I'm not trying to discourage you. I'm saying look at the Whole picture, understand your aim, your goal, your reasoning. Understand that writing a CMS from scratch could realistically take several months, to a year or more. Would your goal be better served by digging into the code of existing CMS packages? Many - dare I say most(?) - of us have spent extensive time on projects that were never completed. Ask yourself what is the best way to achieve your desired result.

Collapse
 
justinhtdang profile image
Justin Dang

The main objective here is to learn how to design and build something from scratch. I picked a blogging engine because it is reasonably simple and it is a use case I understand very well.

I wanted to host my own site on this because I want this project to have a real user (in this case myself). I'm not in a rush at the moment as my current blog is hosted on Ghost, however, does a project like this really take up to a year to complete? I can't see how this (at least the MVP) is that complex.

Collapse
 
listnux profile image
ListNUX

does a project like this really take up to a year to complete?

Definitively not, if you go the Flask route. Flask already has an extension for pages (Flask FlatPages) and, with a basic understanding of Python and Flask, you can have a simplistic blog in a few hours. Then you can dig in deeper and add functionalities as you go.

Also, building things from scratch is a great way to practice and get experience.

Thread Thread
 
justinhtdang profile image
Justin Dang

That is very good to hear! I realise that building thing from scratch is something missing in my uni education (since most assignment have a spec given to you) which is why I wanted to do something like this

Collapse
 
manindu profile image
Manindu Wijewickrama

Have you considered using Gatsby, or NextJS as the frontend framework and using a headless cms such as Prismic to manage your content?. I used Gatsby to build my blog. Content is created in markdown and the blog is deployed on Netlify which has a free plan. It's pretty convenient.

Collapse
 
justinhtdang profile image
Justin Dang

Thanks for the advice! I wanted to build a CMS primary to practice system design and Python which is the only reason I'm not going with an existing solution. I'll keep those techs in mind though, in case I found other use cases.

Collapse
 
saulsilver profile image
Hatem Houssein

NetlifyCMS uses JAMstack (Javascript, API, Markdown) and Github flow. JAMstack is a fairly new way of building static websites. The thing is great and I've tried it personally and am loving it.

You can check out NetlifyCMS' video here.

Collapse
 
justinhtdang profile image
Justin Dang

That look interesting as the three components (Javascript, API, Markdown) is exactly how I imagine my architecture to be. Thanks for the resource!

Collapse
 
trendschau profile image
Sebastian Schürmanns

I just stumbled upon this post and I am pretty late, but if you are still working on that side project: I started a flat-file-cms (called typemill) as a side project three years ago. I run several web projects with it and I still work on it because it is a great way to learn new concepts and new technology. One of the basic learnings was the concept of event driven programming which is one way to enhance a cms with a plugin system (which is very essential in my eyes). There are a lot more challenges like managing forms in some ways, creating or using an ACL (access control layer) for user management and much more. If you want a more API-based aproach then you can learn about JWT (Json Web Tokens), new frontend frameworks like vue or react which are the right way to build admin interfaces today, there are very exciting new content editors like editorjs.io (one of the newest kid on the block) and much more. So you will always have a lot of interesting stuff to play with and the todo list will probably never end. Good luck with your project :)