Installation

This guide will walk you through installing Django Messaging in your Django project.

Prerequisites

Before installing Django Messaging, ensure you have:

  • Python 3.8 or higher
  • Django 4.2 or higher
  • A Django project set up and running

Step 1: Purchase and Download

Get the django_messaging-0.19.1-py3-none-any.whl package from Gumroad.

Step 2: Install the Package

There are two ways to install the package:

  1. Create a directory private_wheels/ in your project's repository:
mkdir private_wheels
  1. Copy the wheel file to this directory:
cp /path/to/django_messaging-0.19.1-py3-none-any.whl private_wheels/
  1. Add the package to your requirements.txt:
Django>=4.2
djangorestframework>=3.14
file:./private_wheels/django_messaging-0.19.1-py3-none-any.whl
  1. Install the requirements:
pip install -r requirements.txt

Option B: Direct Installation

Install the wheel file directly:

pip install /path/to/django_messaging-0.19.1-py3-none-any.whl

Step 3: Add to INSTALLED_APPS

Add django_messaging to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    # For WebSocket support (optional, add before django.contrib apps)
    "daphne",  # Only if using WebSocket transport

    # Django contrib apps
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",

    # Third-party apps
    "rest_framework",  # Required
    "django_messaging",  # Add this

    # Your apps
    # ...
]

Note

If you plan to use WebSocket transport, add "daphne" before the Django contrib apps. For polling transport, you can skip this.

Step 4: Add Context Processor

Add the context processor to your TEMPLATES configuration in settings.py:

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "django_messaging.context_processors.messaging_settings",  # Add this
            ],
        },
    },
]

Step 5: Configure URLs

Include the app URLs in your project's urls.py:

from django.urls import path, include

urlpatterns = [
    # ... your other URL patterns
    path("messages/", include("django_messaging.urls")),
]

Tip

You can use any URL prefix you prefer. For example, path("chat/", include("django_messaging.urls")) would make the messaging interface available at /chat/.

Step 6: Run Migrations

Apply the database migrations:

python manage.py migrate

Step 7: Collect Static Files

Collect the static files for production:

python manage.py collectstatic

Verify Installation

To verify that Django Messaging is installed correctly:

  1. Start your development server:
python manage.py runserver
  1. Navigate to http://127.0.0.1:8000/messages/ in your browser

  2. You should see the messaging interface (you'll need to be logged in)

Next Steps

Now that Django Messaging is installed, you can:

Troubleshooting

Import Error

If you get an import error, make sure:

  • The package is installed in your virtual environment
  • django_messaging is in your INSTALLED_APPS
  • You've activated your virtual environment

Static Files Not Loading

If static files aren't loading:

  • Run python manage.py collectstatic
  • Check that django.contrib.staticfiles is in INSTALLED_APPS
  • Verify your STATIC_URL and STATIC_ROOT settings

Database Errors

If you get database errors:

  • Make sure you've run python manage.py migrate
  • Check that your database is properly configured in settings.py