Skip to content

vedjaw/messaging-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pulse Messaging System

This repository contains a Django messaging application with a modern interface, custom user model, privacy controls, online status, and read receipts.

Overview

The application allows users to create accounts, send direct messages, and control privacy settings for last seen and read receipts.

Key features:

  • Custom user model with username based authentication
  • User privacy settings for last seen and read receipts
  • Online status and last seen display
  • Read receipts for sent messages
  • Inbox view with conversation list
  • Timezone set to Asia/Kolkata
  • Admin interface for managing users and messages

Folder structure

  • accounts/ - custom user model, authentication views, forms, and privacy settings
  • messaging/ - messaging models, views, templates, and utilities
  • messenger/ - Django project settings and URL configuration
  • templates/ - base template shared by apps
  • db.sqlite3 - local SQLite database file
  • requirements.txt - Python dependencies

Setup

Follow these steps to run the project locally.

  1. Open a terminal and change to the project directory.

    cd /path/to/messaging-system

  2. Create a Python virtual environment.

    python3 -m venv venv

  3. Activate the virtual environment.

    source venv/bin/activate

  4. Install the required packages.

    pip install -r requirements.txt

  5. Copy the example environment file or create a new .env file with the required settings.

    SECRET_KEY=your_secret_key_here DEBUG=True ALLOWED_HOSTS=127.0.0.1,localhost

  6. Create database migrations and apply them.

    python manage.py makemigrations python manage.py migrate

  7. Create a superuser account.

    python manage.py createsuperuser

  8. Run the local development server.

    python manage.py runserver

  9. Open the site in your browser.

    http://127.0.0.1:8000/

Important settings

The project is configured with:

  • TIME_ZONE = 'Asia/Kolkata'
  • LOGIN_URL and authentication middleware enabled
  • custom privacy middleware to update user last seen on each request

How to reproduce this work

  1. Start by creating a new Django project with django-admin startproject.
  2. Create two apps: accounts and messaging.
  3. Define a custom user model in accounts/models.py and update AUTH_USER_MODEL.
  4. Add a middleware that updates last_seen for authenticated users.
  5. Build forms and views for signup, login, inbox, message threads, and privacy settings.
  6. Create templates for the base layout, inbox, chat view, signup, login, and privacy settings.
  7. Add boolean fields to the user model for show_last_seen and show_read_receipts.
  8. In the chat view, pass receiver status and privacy settings to the template.
  9. Use conditional template rendering to show online status, last seen text, and read receipt ticks.
  10. Test the app manually and with Django test cases.

Running tests

Use this command to run the test suite.

python manage.py test

Notes

  • Make sure the virtual environment is active before running commands.
  • If you add new fields to models, create and apply migrations.
  • Use secure production settings for deployment instead of DEBUG=True.

Contact

Use the admin interface or command line to manage users and messages.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors