Add MyLiveChat to your Django app

Django templates inherit from a base template, so one edit reaches every page that extends it. Add the chat code to templates/base.html, just before the closing body tag, and every view rendered through that base carries the launcher.

Use this guide to add MyLiveChat to Django. The free plan includes one agent, unlimited chats, and unlimited websites — no credit card required.

If you do not have a MyLiveChat account yet, create a free MyLiveChat account.

Start free
Live chat setup guide

Step 1. Get your MyLiveChat code

Sign in to the MyLiveChat web console and click Deployment menu on the left. Choose Embedded Chat tab and copy the MyLiveChat code.

Step 2. Add the code to your Django project

  1. Open your base template — commonly templates/base.html or <app>/templates/base.html.
  2. Paste the MyLiveChat code from Step 1 immediately before the closing </body> tag, outside any {% block %} a child template might override.
  3. Save the file and reload a page in your browser.
  4. Deploy, and confirm the launcher on the live site as well as locally.

Keeping the code outside a block matters: if you place it inside {% block content %}, any template that overrides that block without calling {{ block.super }} silently loses the chat button on those pages.

Check that live chat is working

Do not assume the install worked because you saw no error. Open your site in a private browsing window and walk through this once:

  1. Look for the chat launcher on the page. If it is missing, view the page source and search for mylivechat to confirm the code is really being served.
  2. Start a chat as a visitor and send a test message.
  3. Sign in to the web console and confirm the message arrives and that you can reply.
  4. Close the chat and check the transcript is saved, so you know follow-up will work.

Check the deployed site, not just runserver. Production usually serves through a different settings module and a real web server, and a template directory that is configured differently there is a common reason the code is missing in production only.

Common Django setup mistakes

  • The code was placed inside a template block. A child template that overrides the block replaces your code. Put it outside every block, just before </body>.
  • Only one base template was edited. Projects often accumulate several bases — one for the public site, one for the admin area. Check each one your visitors reach.
  • A Content Security Policy blocked it. If you use django-csp or send CSP headers yourself, add the MyLiveChat domain to script-src.
  • Only the development server was tested. Confirm the launcher on the deployed site, where template directories and settings differ.

What happens next?

After setup, sign in to the web console to answer visitors from your browser. You can also use the desktop app from the download page if your team prefers it.

Want the AI to answer first? Point the AI assistant at your site content and it handles routine questions 24/7, then hands off to a human with the full transcript when one is needed.

Why add live chat to a Django site?

Django is a common choice for content-heavy sites and internal tools alike. In both cases the visitor with a question is usually looking at a page that does not answer it, and chat is the shortest route to someone who can.

The install touches one template and no Python. There is no app to add to INSTALLED_APPS, no migration, and nothing to keep in step with your Django version.

Django live chat FAQ

Which template should I edit?

Your base template, usually templates/base.html, with the code just before the closing body tag.

Why does the chat button disappear on some pages?

The code is probably inside a template block that those pages override. Move it outside every block.

Do I need to add anything to INSTALLED_APPS?

No. The widget is a script tag in a template, so there is no Django app, no middleware, and no migration.

It works locally but not in production. Why?

Production usually uses a different settings module and template directories. Confirm the deployed template is the one you edited.

Is it really free?

Yes. One agent, unlimited chats, and unlimited websites are free forever, with no credit card required.

Make the chat window fit your site

Colours, position, language, the pre-chat form and your offline message are all set in your MyLiveChat dashboard rather than in your Django code, so you can change them without editing your project again. See customization options for what can be changed, and visitor monitoring if you want to see which page a visitor is on before you reply.

Related guides

New to live chat? Start with how to add live chat to your website and the live chat launch checklist, then live chat best practices once you are answering real conversations. Also useful: Adding a chat link where JavaScript is blocked and Controlling which visitors can see your chat widget. If you are worried about page speed, see does live chat slow down your website.

Any questions?

If anything is unclear, contact our support team from the chat button on this page or visit the Support page. We can help you choose the right setup path.

Free forever for 1 agent

Give every visitor an instant way to reach you.

Launch live chat, connect your knowledge base, and add AI answers when you are ready. No credit card, no trial clock.