Git Product home page Git Product logo

wagtail-websockets's Introduction

Wagtail Websockets (WIP)

NOTE: This is a work-in-progress/pre-alpha package, and is mostly intended as a proof of concept.

Library to use django-channels within the context of Wagtail, with the first use-case being content-locking.

Requirements

  1. Wagtail
  2. Redis

Installation

  1. In your Wagtail project, run:
pip install git+https://github.com/nypublicradio/wagtail-websockets.git
  1. Add channels and content_locking to your INSTALLED_APPS above all the Wagtail imports:
INSTALLED_APPS = [
	...
        'channels',
	'content_locking', # Put this before wagtail apps
	...
        'wagtail.contrib.forms',
        'wagtail.contrib.redirects',
        ...
]
  1. In your settings.py, add the following block:
# The line below references a file we will create in step 4:
ASGI_APPLICATION = '<YOURPROJECTNAME>.routing.application'

# This references a Redis server that you will need to run - the IP address and
# port should match your own server:
CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('127.0.0.1', 6379)],
        },
    },
}
  1. Create a file called routing.py in your main project folder (e.g. the same folder with urls.py):
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import path

from content_locking import routing

application = ProtocolTypeRouter(
    {
        "websocket": AuthMiddlewareStack(
            URLRouter(routing.websocket_urlpatterns)
        )
    }
)

wagtail-websockets's People

Contributors

kaedroho avatar mike-hearn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.