Chapter 1. Blueblog – a Blogging Platform

We are going to start with a simple blogging platform in Django. In recent years, Django has emerged as one of the clear leaders in web frameworks. When most people decide to start using a web framework, their searches lead them to either Ruby on Rails (RoR) or Django. Both are mature, stable, and extensively used. It appears that the decision to use one or the other depends mostly on which programming language you're familiar with. Rubyists go with RoR, Pythonistas go with Django. In terms of features, both can be used to achieve the same results, although they have different approaches to how things are done.

One of the most popular blogging platforms these days is Medium, widely used by a number of high profile bloggers. Its popularity stems from its elegant theme, and simple-to-use interface. I'll walk you through creating a similar application in Django, with a few surprise features that most blogging platforms don't have. This will give you a taste of things to come, and show you just how versatile Django can be.

Before starting any software development project, it's a good idea to have a rough roadmap of what we would like to achieve. Here's a list of features that our blogging platform will have:

  • User should be able to register an account and create their blogs
  • Users should be able to tweak the settings of their blogs
  • There should be simple interface for users to create and edit blog posts
  • Users should be able to share their blog posts on other blogs on the platform

I know this seems like a lot of work, but Django comes with a couple of contrib packages that speed up our work considerably.

The contrib packages

The contrib packages are a part of Django that contain some very useful applications that the Django developers decided should be shipped with Django. The included applications provide an impressive set of features, including some that we'll be using in this application:

  • Admin is a full featured CMS that can be used to manage the content of a Django site. The Admin application is an important reason for the popularity of Django. We'll use this to provide an interface for site administrators to moderate and manage the data in our application
  • Auth provides user registration and authentication without requiring us to do any work. We'll be using this module to allow users to sign up, sign in, and manage their profiles in our application

Note

There are a lot more goodies in the contrib module. I suggest you take a look at the complete list at https://docs.djangoproject.com/en/stable/ref/contrib/#contrib-packages.

I usually end up using at least three of the contrib packages in all my Django projects. They provide often-required features like user registration and management, and free you to work on the core parts of your project, providing a solid foundation to build upon.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.30.19