News

Building And Implementing A Message Board App Using Django

Introduction

In this article, we shall use a database for the first time to build a basic Message Board App where users can post and read short messages.

Initial Setup

At this point, we should be getting a bit familiar with the initial setup for a Django project so we can quickly run through the standard initial setup commands to begin a new one. We need to do the following:

  1. Create a new directory for our code called mb.
  2. Install Django in a new virtual environment.
  3. Create a new project called mb_project.
  4. Create a new app called posts.
  5. update settings.py.

In a new command line console, enter the following commands:

mkdir mb && cd mb

pipenv install django==3.0.1

pipenv shell

django-admin startproject mb_project

python manage.py startapp posts

Next, we need  to alert Django to the new app, posts, by adding it to the bottom of the INSTALLED_APPS section of our settings.py file. To do this, we need to do the following:

mb_project/settings.py

INSTALLED_APPS = [

‘django.contrib.admin’

‘django.contrib.auth’

‘django.contrib.contenttypes’

‘django.contrib.sessions’

‘django.contrib.messages’

‘django.contrib.staticfiles’

‘posts.apps.PostsConfig’,

]

Then execute the migrate command to create an initial database on Django’s default server. To do this, type the following command in the command prompt:

python manage.py migrate

Olamide Ayeni

Share
Published by
Olamide Ayeni

Recent Posts

10 Reasons Why You Should Learn Python In 2025.

Introduction In the fast paced world of technology, learning a versatile and high-in-demand programming language…

3 days ago

Building And Implementing A Blog App Using Django: User Authentication

Introduction User Authentication policy is a very crucial process for every application and organization. It…

3 weeks ago

Building And Implementing A Blog App Using Django: Adding Forms

Introduction In previous articles, we have learnt about Django, how it works and how we…

1 month ago

Building And Implementing A Blog App Using The Django Framework

Introduction In this article, we shall learn how to build and implement a blog app.…

1 month ago

Building And Implementing A Two Paged Web Application Using Django

Introduction In this article, we will build a pages app that has a homepage and…

2 months ago

Logical Steps On How To Create Your First App In Django

Introduction When you say you want to use Django, it means you want to build…

2 months ago