Using FormBeep with Django#

Django natively renders robust templates. Because Django operates on the backend to render HTML strings sent to the browser, you can largely use FormBeep exactly as you would on a static HTML page.

Step 1: Add Allowed Domain#

Add the domain where your Django app is hosted to your FormBeep Dashboard. For local testing, add localhost or 127.0.0.1.

Step 2: Inject the Script#

Place the script tag in your base.html template right before the </body> tag so it’s globally available, or in a specific block if you only want it on pages with forms.

<!-- base.html -->
<body>
  {% block content %}
  {% endblock %}
  
  <script src="https://api.formbeep.com/v1/s/formbeep.js"
        data-api-key="YOUR_API_KEY"></script>
</body>

Step 3: Removing Django CSRF Wait…#

Django’s forms usually require the {% csrf_token %} tag explicitly because they POST back to your own server routes.

However, since FormBeep hijacks the form submission and sends an AJAX request directly to https://api.formbeep.com, you do not need a CSRF token inside the form. FormBeep is an external service, and CSRF protection only applies to requests targeting your Django application.

<form id="contact-form">
  <!-- No csrf_token tag needed here! -->
  <input name="name" type="text" placeholder="Name" required>
  <input name="email" type="email" placeholder="Email" required>
  <textarea name="message" placeholder="Message" required></textarea>
  <button type="submit">Submit</button>
</form>

FormBeep handles all cross-origin requests securely outside of Django’s internal routing.