A Django-based real-time messaging application that provides chat functionality with WebSockets using Django Channels.
- Real-time chat messaging
- Chat room creation and management
- User authentication and permission control
- WebSocket-based communication
- Modern Bootstrap 5 interface
- Python 3.12
- Django 5.1
- Django Channels for WebSockets
- Celery for background tasks
- Bootstrap 5 for frontend UI
- SQLite (default) / MySQL support
# Clone the repository
git clone https://github.com/yourusername/rtm_chat.git
cd rtm_chat
# Update submodules
git submodule update --init
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Upgrade pip and install packages
pip install --upgrade pip
pip install -r requirements/py312_dj5.txt
# For MySQL support (optional)
pip install -r requirements/mysql.txt
# Migrate models to database
python manage.py migrate
# Configure project/.env
dotenv="project/.env"
if [ ! -f $dotenv ]; then
touch ${dotenv}
secret=$(python manage.py generate_secret_key)
echo "DJANGO_SECRET_KEY=\"${secret}\"" >> ${dotenv}
echo "DJANGO_DEBUG=true" >> ${dotenv}
echo "BOOTSTRAP=bs5" >> ${dotenv}
fi
# Run the development server
python manage.py runserverapps/- Contains Django applicationschat/- Main chat application with real-time messaging functionalitygizmo/- Utility application
common/- Common utilities and shared codeproject/- Django project configurationqux/- Core functionality and utilitiestemplates/- Global templatesrequirements/- Dependency requirements files
DJANGO_SECRET_KEY- Secret key for DjangoDJANGO_DEBUG- Debug mode (true/false)DJANGO_ALLOWED_HOSTS- Allowed hosts for DjangoDJANGO_SITE_ID- Site IDBOOTSTRAP- Bootstrap version (default: bs5)
DB_TYPE- Database type (sqlite3/mysql)DB_NAME- Database nameDB_USERNAME- Database usernameDB_PASSWORD- Database passwordDB_HOST- Database hostDB_PORT- Database port
- Make sure Docker and Docker Compose are installed
- Run
docker-compose up -d - Access the application at http://localhost:8000
The project uses the following code quality tools:
- Black for code formatting
- isort for import sorting
- pylint for linting
Run tests with:
python manage.py testA basic deployment script is provided in deploy.sh.
See the LICENSE file for licensing information.