Skip to main content

A helper for switching between test and production versions of a service module

Project description

django-lazy-services

A helper for switching between test and production versions of a service

Purpose

Lets you easily switch between versions of a service based on a Django setting entry. Good for situations where you want to use different versions between production and development and/or test. In the client code you might use: from . import my_service which might go to either .services.MyService or .services.MyFakeService depending on the content of your settings.

Usage

Construct your service as a class whose init takes no arguments.

In services.py:

class MyService:
    def __init__(self):
        pass
    def hello(self):
        print("hello world")

Declare the service.

In __init__.py:

from lazy_services import LazyService
my_service = LazyService("MY_SERVICE")

Select the service.

In settings.py

MY_SERVICE = "my_project.services.MyService"

Use the service.

from . import my_serivce
my_service.hello()

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-lazy-services-0.0.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

django_lazy_services-0.0.3-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file django-lazy-services-0.0.3.tar.gz.

File metadata

  • Download URL: django-lazy-services-0.0.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for django-lazy-services-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2a4b52e1c354125306033bf3b34b9481c8ed44764376709310c59986144b20bb
MD5 a8ffd6bab6578def988b37c2211bd9c8
BLAKE2b-256 87d137cca1db0276ba7e0dc02a673f18fa3068bb172b2d18c4150289924fee22

See more details on using hashes here.

File details

Details for the file django_lazy_services-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: django_lazy_services-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for django_lazy_services-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6bfe8fce78488dabd8c4141eb76d2a6b04095ed01e74fb8006290a0bfbda042f
MD5 daa7ab1c30516d88d13437d0f2054ef6
BLAKE2b-256 7caf913088070990f49c7e1a62ea4c59df99c8181ab571fc9cde02185ae5e6e4

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