Simple Live Chat Room Site in Python using Django and WebSockets Free Source Code

Language

Simple Live Chat Room System using Django in Python

This project is entitled Simple Live Chat Room System. This is a web-based application that was developed in Python and Django Framework. The application is a simple chat room for random users. All can communicate in a single chatbox or conversation box. The chat messages are automatic updates to all client or user windows. The new messages are being rendered in the chatbox without reloading or refreshing the page. This application has a simple user interface using the Bootstrap v5 framework. The simple chat room application consists of user-friendly features and functionalities.

About the Simple Live Chat Room System

I developed this project using the following:

  • Python
  • Django
  • HTML
  • CSS
  • JavaScript
  • jQuery
  • Ajax
  • Bootstrap v5
  • Font-Awesome
  • Python WebSockets

This Simple Live Chat Room System Project is accessible to any user. The application does not require any registration to gain access to the main feature. User is only required to enter their desired username as the user identification on the conversation. Talking about the chatbox or conversation box, it will only load a maximum of 20 messages at first to load the page fast. Users can load the old messages by scrolling the chatbox to the top. When scrolling the con box to the top, the system executes an Ajax Request to load a maximum of 10 old messages. This strategy will prevent the slow execution of the said feature in the future. Chatbox will display the New Message button when there's a new message received while the user is not at the bottom. When the New Message Button is being clicked, the chatbox will automatically be scrolled to the latest message.

Features

  • Login Page
  • Live Conversation Box or Chat Room Box
  • Automatically renders new messages
  • Automatically Loads older messages when scrolled to the top
  • Display message when a new user joins in the conversation
  • Display message when the user has left the chat room

Sample Snapshots

Chat Room Interface

Simple Live Chat Room System

Loading Old Messages

Simple Live Chat Room System

New Message Button

Simple Live Chat Room System

User Reached the oldest Message

Simple Live Chat Room System

The system source code is free to download on this project and only for educational purposes only. The source code is not that so tricky which means not that difficult to understand. Feel free to download and modify the source code the way you wanted.

How to Run

Download/Install the following

  • Python (I used v3.9.1)
  • PIP (for python modules installation)

Setup/Installation

  1. Download and Extract the provided source code zip file. (download button is located below)
  2. Open your Terminal/Command Prompt window. (make sure to add "python" and "pip" in your environment variables)
  3. Change the working directory to the extracted source code folder. i.e. cd C:\Users\Personal-23\Desktop\django_btrs
  4. Run the following commands:
    • pip install -r requirements.txt
    • python manage.py migrate
    • python manage.py runserver
  5. Open another terminal redirect to the directory. Run the following command.
    • python chats_ws.py
  6. Keep the terminals open and running.
  7. Open a web browser and browse http://localhost:8000/ or http://127.0.0.1:8000/

Note: I might miss listing some other modules/libraries. Kindly Install the missing modules if any occurred.

Access Information for AdminSite

SuperUser
Username: admin
Password: admin123

DEMO VIDEO

That's it! I hope this will help you with what you are looking for. Maybe you'll find this Simple Live Chat Room System useful and can help you with your future Python Django Projects.

Explore more on this website for more Free Source Codes and Tutorials.

Enjoy :)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 11 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.