Skip to main content

Django redis Push Pull models and management commands

Project description

Installation

$ pip install django-aiohttp-rq

settings.py

INSTALLED_APPS+=['django_aiohttp_rq']

AIOHTTP_RQ_REDIS_HOST = 'localhost'
AIOHTTP_RQ_REDIS_PORT = 'aiohttp-rq-request-exception'
AIOHTTP_RQ_RESPONSE_QUEUE = 'aiohttp-rq-response'

# optional
AIOHTTP_RQ_RESTART_INTERVAL=600
AIOHTTP_RQ_SLEEP_INTERVAL=0.1 # 0.1 default

AIOHTTP_RQ_REQUEST_QUEUE = 'aiohttp-rq-request'
AIOHTTP_RQ_REQUEST_EXCEPTION_QUEUE = 'aiohttp-rq-request-exception'
AIOHTTP_RQ_RESPONSE_QUEUE = 'aiohttp-rq-response'

migrate

$ python manage.py migrate

Features

  • based on aiohttp-rq
  • push (Request)/pull (RequestException, Response) models
  • logging
    • logging.debug messages
    • logging.conf autoload (if exists)
  • aiohttp_rq_bridge worker command
    • aiohttp_rq_extra.py extra command created by
  • admin

Models

model db_table fields/columns
Request aiohttp_rq_request id,worker,name
RequestException aiohttp_rq_request_exception id,url,method,data,headers,allow_redirects,max_redirects
Response aiohttp_rq_response id,url,status,headers,content_path,created_at

Management commands

name description
aiohttp_rq_bridge aiohttp_rq bridge worker
aiohttp_rq_pull pull to RequestException and Response
aiohttp_rq_push push Request to AIOHTTP_RQ_REQUEST_QUEUE
aiohttp_rq_extra not implemented

Examples

$ python manage.py aiohttp_rq_bridge

aiohttp_rq_extra.py

# apps/aiohttp_rq_extra/management/commands/aiohttp_rq_extra.py
from django.core.management.base import BaseCommand
from django.db import connection

class Command(BaseCommand):
    def handle(self, *args, **options):
        cursor = connection.cursor()
        cursor.execute('CALL aiohttp_rq_extra()')

Project details


Download files

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

Source Distribution

django_aiohttp_rq-0.0.7.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file django_aiohttp_rq-0.0.7.tar.gz.

File metadata

  • Download URL: django_aiohttp_rq-0.0.7.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for django_aiohttp_rq-0.0.7.tar.gz
Algorithm Hash digest
SHA256 46567db724c9f7a37cdfb3471af3d60afebfba79a6200ace050644cb27743451
MD5 c24d547c5e3b185fe1df1042f8fee9de
BLAKE2b-256 f3767dbe7a22a564e68814f349425371aed326ab6b371aab71bf9f6254201124

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page