it couldn’t get any easier than pip install django-blog-pkg

Blog App as a Package

Olaoluwayemi Rasheed
2 min readAug 11, 2020

--

Creating blogs on your django project can be as easy as pip install django-blog-pkg

Hi, I am Olaoluwayemi Rasheed. I just created a Django blog app as a package for Django developers.

As a developer, you no longer have to worry about writing numerous lines of codes because you want to add a blog to your Django project. All you have to do now is simply pip install django-blog-pkg in your Django root directory and voila, you have successfully created your blog.

Now you can focus more on creating more functions for your main projects. Blogs shouldn’t be a headache anymore. The time you spend on creating a functional blog app on your main project has been taken care of by a single-line command

pip install django-blog-pkg

INSTALLATION

Django

Python Package:

pip install django-blog-pkg

Other Important Apps to Install:

pip install django-crispy-forms

pip install django-ckeditor

settings.py

(Important — Please note ‘django.contrib.humanize’ is required as INSTALLED_APPS):

# Include the following in your INSTALLED_APPS

INSTALLED_APPS = [
...
# The following apps are required:

'django.contrib.humanize',
'ckeditor',
'crispy_forms',

'blog',

]
# add the following directly below the INSTALLED_APPS

CKEDITOR_UPLOAD_PATH = 'uploads/'

CRISPY_TEMPLATE_PACK = 'bootstrap4'


MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

urls.py

urlpatterns = [
...
path('blog/', include('blog.urls')),
path('ckeditor/', include('ckeditor_uploader.urls')),
...
]
# You can use the URLs provided by the "blog" app: `post_list`, `post_detail`, `post_tag`, `post_update`, `post_delete`, `post_create`, `search_blog`, `user_post`

# now add the following lines of code

from django.conf import settings
from django.conf.urls.static import static

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Post Installation

In your Django project root execute the command below to create your database tables:

python manage.py makemigrations

python manage.py migrate

Start the development server

python manage.py runserver

and visit

http://127.0.0.1:8000/admin/
or
http://127.0.0.1:8000/blog/create/new/

to create blog posts (you’ll need the Admin app enabled).

Read the full documentation on https://django-blog-pkg.readthedocs.io/

You can get the source code here: my GitHub page

Happy coding 🚀

--

--

Olaoluwayemi Rasheed
Olaoluwayemi Rasheed

Written by Olaoluwayemi Rasheed

I’m a Software Engineer. I am interested in Technology and getting better at what I do 😁

No responses yet