A real-time chat application built with Django and Django Channels.
- Real-time messaging using WebSockets
- User authentication (signup, login, logout)
- Chat rooms with unique URLs
- Profile management
- Password change functionality
- Python 3.8 or higher
- pip (Python package manager)
- Virtual environment (recommended)
-
Clone the repository:
git clone <repository-url> cd chatroom
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run migrations:
python manage.py migrate
-
Create a superuser (optional):
python manage.py createsuperuser
Run the server using Daphne (ASGI server):
daphne -b 0.0.0.0 -p 8000 chatroom.asgi:applicationRun the server using Django's development server:
python manage.py runserver-
Open your browser and go to:
http://localhost:8000/ -
Sign up or log in with a user account.
-
Join or create a chat room.
-
Send messages in the chat room.
-
Check the browser console (F12) for WebSocket connection status:
- You should see: "WebSocket connection established"
- Messages should appear instantly in the chat window.
-
Test with multiple users:
- Open another browser window or use incognito mode.
- Log in as a different user and join the same chat room.
- Send messages from both users to see real-time updates.
- If WebSocket connections fail, ensure you are running the server with Daphne.
- Check the browser console for any error messages.
- Ensure all dependencies are installed correctly.
This project is licensed under the MIT License.