Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Webmention support for any Django model.

Project description


Mentions lets you add Webmention functionality to any Django model with minimal setup. There is an implementation running at with source code available here.


PyPI: django-wm

pip install django-wm



Mentions uses Celery and RabbitMQ for running tasks asynchronously. If you do not use them already you will need to set them up first.


sudo apt install rabbitmq-server

# Create user for celery service and make sure it can access your database
# e.g:
sudo useradd -N -M --system -s /bin/bash celery
sudo usermod -a -G www-data celery

# Run celery
sudo -u celery env/bin/celery -A projectname worker &


Add to your root project. For an example implementation see from the example project.

Project code

  1. Root project

    • Set DOMAIN_NAME:

      DOMAIN_NAME = ''  # e.g. ''
    • Add “mentions” to INSTALLED_APPS:

    • Add :code:’mentions.middleware.WebmentionHeadMiddleware’ to MIDDLEWARE:

      MIDDLEWARE = [
  2. Root project

    urlpatterns = [
        path('webmentions/', include('mentions.urls')),
  3. Include MentionableMixin in the model(s) you want to support webmention functionality.

    IMPORTANT: Any models that include the mixin must also implement all_text and get_absolute_url methods:

    from mentions.models.mixins.mentionable import MentionableMixin
    class MyModel(MentionableMixin, models.Model):
        def all_text(self) -> str:
            return f'{self.introduction} {self.content}'
        def get_absolute_url() -> str:
            return reverse('', kwargs={'slug': self.slug})
  4. Update database tables:

    python makemigrations
    python migrate

Optional Settings

Add these keys to your project to alter default behaviour.

WEBMENTIONS_AUTO_APPROVE = bool (default: False)

  • True: Received webmentions are automatically approved and may be publicly visible.
  • False: Received webmentions require manual approval before they can be made public.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-wm, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size django_wm-1.3.0-py3-none-any.whl (45.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-wm-1.3.0.tar.gz (33.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page