This module contains the implementation of a basic chat application using Django Channels and the AsyncConsumer class.
Classes:
- ChatConsumer: Handles the WebSocket connections for the chat app.
Note: This is a basic implementation and can be extended to include additional features like user authentication, message persistence, etc.
First clone the github repository
git clone https://github.com/nmastepankaj/chat_app_django_channel_async_consumer.git
Open the repository folder in any code editor (VS code) or open any terminal. Move to the mysite folder and install all the requirements.
cd mysite
You need to create virtual environment for the project. If you don't have virtualenv the install it using the below command :-
virtualenv venv
Now, activate the virtual environment using the below command. If you're window user :-
./venv/Scripts/activate
If you're linux user :-
source venv/bin/activate
install all the project requirements
pip install -r requirement.txt
Now, you need to create migrations and migrate all the migrations
python manage.py migrate
Run your project
python manage.py runserver
Now your application is ready to use.
Open this url (http://127.0.0.1:8000/chat/home/) in two different tabs and start messaging
I'm a full LAMP stack developer with Django as backend and React as frontend.
If you have any feedback, please reach out to us at my profile link provided above.
For support, email [email protected] or follow me on insta or linkedin (nmastepankaj).
- Code of this project is taken from the Django Channel official website.
- for more information visit CodingNap.