Creating A Blog Platform Using Django - by SarahDev - Jul, 2023 - Medium
Creating A Blog Platform Using Django - by SarahDev - Jul, 2023 - Medium
Member-only story
Listen Share
Creating a Blog Platform using Django is an excellent project to improve your web
development skills. In this tutorial, I’ll guide you through the steps to build a fully
functional blog application where users can register, create, publish blog posts, and
interact with comments. Additionally, we’ll include an admin panel for managing
blog posts, user accounts, and comments.
Prerequisites:
Before you start, make sure you have the following installed on your system:
Python (https://www.python.org/downloads/)
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 1/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
cd blog_platform
# blog_platform/settings.py
INSTALLED_APPS = [
# Other apps...
'blog',
]
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 2/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
# blog/models.py
class Category(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Post(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=200)
content = models.TextField()
category = models.ForeignKey(Category, on_delete=models.CASCADE)
tags = models.ManyToManyField('Tag', blank=True)
pub_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
class Tag(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class Comment(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE)
user = models.ForeignKey(User…
Continue in app
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 3/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
Follow
Written by SarahDev
149 Followers
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 4/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
SarahDev
26
SarahDev
41 2
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 5/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
SarahDev
22
SarahDev
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 6/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
Pwaveino Clarkson
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 7/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
DevSumitG
19
Lists
New_Reading_List
174 stories · 96 saves
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 8/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
Hivan du
46
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 9/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
Django is a powerful web framework for building web applications in Python. When it comes to
handling views, Django provides two main…
30
Suhas Tumati
Django fields
In this reading, you will learn about different field types in a model class.
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 10/11
09/09/2023 19:00 Creating a Blog Platform using Django | by SarahDev | Jul, 2023 | Medium
11
https://medium.com/@sarahisdevs/creating-a-blog-platform-using-django-15ffe36527cc 11/11