Skip to main content

Installing BDOW! on Django

You can easily host BDOW! campaigns on your Django-powered website.

Written by Cassandra Campbell

Getting BDOW! up and running on Django is simple, but first you will need your installation code.

Copy it by navigating to Site Settings > Details and clicking the View Install Code button. Next, scroll down and click the Universal Installation Code button:

Installing BDOW! on Django

Since BDOW! is loaded via JavaScript, the most straightforward installation on Django is to embed the script in the core index.html template.

  1. Navigate to the folder where your website's files are located and open the main template file for editing (usually this is templates/index.html). You can use any text editor or development environment to make the change.

  2. Paste the BDOW! code from earlier just before the closing </body> tag in your HTML template, and save.

    Here is an example using the imaginary LocalLibrary Django tutorial from Mozilla:

    <!doctype html>
    <html lang="en">
    <head>
    {% block title %}
    <title>Local Library</title>
    {% endblock %}
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
    rel="stylesheet"
    integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
    crossorigin="anonymous">
    <!-- Add additional CSS in static file -->
    {% load static %}
    <link rel="stylesheet" href="{% static 'css/styles.css' %}" />
    </head>
    <body>
    <div class="container-fluid">
    <div class="row">
    <div class="col-sm-2">
    {% block sidebar %}
    <ul class="sidebar-nav">
    <li><a href="{% url 'index' %}">Home</a></li>
    <li><a href="">All books</a></li>
    <li><a href="">All authors</a></li>
    </ul>
    {% endblock %}
    </div>
    <div class="col-sm-10 ">{% block content %}{% endblock %}</div>
    </div>
    </div>

    <!-- Place your BDOW! script here -->
    <script async>(function(s,u,m,o,j,v){j=u.createElement(m);v=u.getElementsByTagName(m)[0];j.async=1;j.src=o;j.dataset.sumoSiteId='abcdef00aa11223344bbcc11223344abcdef4e00457c18005fa73c002a5e3800';v.parentNode.insertBefore(j,v)})(window,document,'script','//load.sumome.com/');</script>

    </body>
    </html>

  3. Publish your changes. This will vary depending on how you are hosting Django, but ultimately the modified index.html file needs to end up on your live webserver.

Congrats, you're all done! Log back into your BDOW! dashboard and start building campaigns!
​

Did this answer your question?