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.2.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-lazy-services-0.0.2.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for django-lazy-services-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bcec3665b7d827044e20e1ac814b7bfefb94fd4bfc96565c5f7639e0bf38efd3
MD5 57325a1c737616e909ec258e71d4b7f4
BLAKE2b-256 5e3d94c35181a8e413f0beff8ff6d961485dcb686ff1073b2fd5c1832a6864e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_lazy_services-0.0.2-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.20.1 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for django_lazy_services-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 18801259ebc52e4aa063ec372c8af9bcd009e86843f47f1abdcc35c0d781b521
MD5 c7f693c2f8333035a77b8e837e7d8c73
BLAKE2b-256 ea1c76e35f1260dd3ba890beb4d9924fe6f0b8cd58006c6db37ee3718732a7ac

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