• Stars
    star
    142
  • Rank 257,678 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Beatserver, a periodic task scheduler for Django 🎵

beatserver

Beat Server

Build Status PyPI version

Beatserver, a periodic task scheduler for django channels | beta software

How to install

Prerequirements:

Follow django channels documentation on howto install channels.

Install beatserver:

pip install -U beatserver

Configurations:

Add beatserver to INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    'beatserver',
    'channels',
    '...'
]

beatconfig.py

from datetime import timedelta

BEAT_SCHEDULE = {
    'testing-print': [
        {
            # will call test_print method of PrintConsumer
            'type': 'test.print',
            # message to pass to the consumer
            'message': {'testing': 'one'},
            # Every 5 seconds
            'schedule': timedelta(seconds=5)
        },
        {
            'type': 'test.print',
            'message': {'testing': 'two'},
            # Precisely at 3AM on Monday
            'schedule': '0 3 * * 1' 
        },
    ]
}

Schedules can be specified as timedeltas for running tasks on specified intervals, or as cron-syntax strings for running tasks on exact schedules.

routing.py

application = ProtocolTypeRouter({
    "channel": ChannelNameRouter({
        "testing-print": PrintConsumer,
    }),
})

consumers.py

from channels.consumer import SyncConsumer

class PrintConsumer(SyncConsumer):
    def test_print(self, message):
        print(message)

How to run:

python manage.py beatserver

More Repositories

1

django-command-palette

A modern Django admin shortcut interface ( kbar )
JavaScript
30
star
2

mkdocs-bulma

A Bulma theme for MkDocs
HTML
8
star
3

webtop

Display Top command output in browser
Python
5
star
4

django-project-structure

Python
5
star
5

download-vsix

Download Visual studio code vsix package
HTML
5
star
6

Flask-Init

Easy way to create Flask Web application
Python
4
star
7

serverless-chatterbot

Bring back chatterbot to live using AWS Lambda
Python
4
star
8

sqlg

Populate sample database entries using JSON
Python
3
star
9

testdjango

Testing Django website
Python
2
star
10

django-real-time

Django Channels real-time project configuration
Python
2
star
11

markopolo

Markup language Parser
Python
2
star
12

hugo-tailwind-demo

This is Hugo Tailwind JIT demo project
HTML
2
star
13

crudproject

Python
2
star
14

autocommit

Automatically Commit Git Code for You
Python
2
star
15

one-click-hugo-cms

CSS
1
star
16

testbook

Leadbook Programming Challenge
JavaScript
1
star
17

stories

Web Stories Framework
CSS
1
star
18

webcar-gui

Web Car Project
JavaScript
1
star
19

bookrweb

JavaScript
1
star
20

trafficlight

React Traffic Light
JavaScript
1
star
21

bookingengine

Python
1
star
22

testgale

Python
1
star
23

flask-jwt-login

Test application using flask sqlalchemy and jwt with login
Python
1
star
24

hqms-hosted

1
star
25

hugo-bulma

A Bulma theme for Hugo
HTML
1
star
26

django-multi-page-application

Python
1
star
27

asgiproject

What we can do with ASGI
Python
1
star
28

rajasimon

My Github Profile
1
star
29

hqms-popup

HQMS Javascript
1
star
30

chatterbot-dynamodb-storage

DynamoDB Storage Adapter for Chatterbot | Work in progress
Python
1
star
31

bookrapi

Bookr Faas Coding Challenge
Python
1
star