Django Real-time Chat: WebSockets, Django Channels, and Deploying to Production

Monday 9:00 am to 12:30 pm, in Sierra 5

About This Tutorial

In the first half of this tutorial, you’ll learn about the fundamentals of WebSockets and you’ll build a real-time chat application using Django Channels. In the second half, you’ll learn how to deploy your app to a production environment in AWS and how to avoid common gotchas in future real-time chat apps you build.

Tutorial outline

Introduction (10 minutes)

  • Introduction, outline, and goals for this tutorial.

Introduction to WebSockets (20 minutes)

  • Why you should have WebSockets in your toolbox
  • What are WebSockets?
  • Advantages of WebSockets
  • Limitations of WebSockets
  • Who uses WebSockets

Intro to Django Channels (20 minutes)

  • What is Channels?
  • Writing your first consumer
  • Writing your second consumer
  • How Channels fits into your stack
  • Walkthrough - building a Real-time Chat application with Django Channels (45 minutes)

  • From our starter Python Django/React Javascript application, we’ll implement real-time chat
  • Getting ready to deploy with Daphne and NGINX (20 minutes)

  • What is daphne?
  • What is NGINX?
  • How to configure NGINX for WebSockets
  • Common Gotchas with NGINX for WebSockets
  • AWS Crash Course (15 minutes)

  • Building blocks of AWS: EC2, VPCs, Security Groups, and Load Balancers
  • Deploying Django Channels to Production (20 minutes)

  • How to set up AWS Infrastructure - using ElasticBeanstalk
  • How to set up ElastiCache (Redis) as our backend store
  • Common performance gotchas with deploying WebSockets
  • Walkthrough - let’s go to prod! (1 hour)

  • We’ll deploy our chat app to AWS using ElasticBeanstalk and ElastiCache
  • Flex Time (remainder of time left)

  • Additional time for questions and coding/configuring
  • Conclusion

  • Wrap up
  • Next step: test your channels app with async tests (resources provided)
  • Additional Resources
  • Attendee Expectation

    We will be building a chat app using Python, Django, and Django Channels on the backend, and ReactJS on the frontend. We will deploy this application to an AWS Account.

    The base Django and React/Webpack setup will be provided so you don’t need to be a Python/Django or React/Javascript expert, but some foundational knowledge is recommended. You will need an AWS account to deploy your app.


      Photo of

      Cara Borenstein

      Hi, I’m Cara! I’m a full-stack web developer and I love taking ideas from prototype to production - gnarly configs included. I’m passionate about empowering more women to become software engineers and to advance in their careers in tech. I currently serve as founder of, the byte-size knowledge base.