Skip to main content

Django management.command is running a long live task, we make it a linux daemon server, so that you can start, stop, restart the task.

Project description

django-command-server

Django management.command is running a long live task, we make it a linux daemon server, so that you can start, stop, restart the task.

Install

pip install django-command-server

Usage

app/management/commands/helloserver.py

import djclick as click
from django_command_server import DjangoCommandServer

class HelloServer(DjangoCommandServer):
    def main(self):
        while True:
            print("hello")

@click.group()
def main():
    pass

hello_server = HelloServer()
hello_server.setup(main)

Notes:

  • django_command_server is not a django application, do do NOT include it in django's INSTALLED_APPS.
  • DjangoCommandServer setup takes a djclick.group(), so create an instance and pass it to setup.
  • Implement your own server main.

Release

v0.1.0 2020/11/09

  • First release.

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-command-server-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file django-command-server-0.1.0.tar.gz.

File metadata

  • Download URL: django-command-server-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8

File hashes

Hashes for django-command-server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1dfb44db1029f9171767035e187e4393e5e78247761553eaaf6654559db0898
MD5 6bc2c14d70286b7c5bcb3b7da6165418
BLAKE2b-256 a490b42c5d41f51e1ebd7d746a0f5446fb167952ecf3c842df95a0b0cedef825

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