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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-lazy-services-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b2bbda976d8b59d2d9cd3c784fe980aa1b23eeaf3fc2bba69c23712b1caf7bca
MD5 c443ce30b72b48964518434786145d88
BLAKE2b-256 cc1c55ae9e302a5134b4f6487829ca579f5475c6c9ce9336019d4a2f8419447e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_lazy_services-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 031d857b3b903f6e9bc1ca1993b931d0fbb0da3bdcbefb08805cf5d183d4ada9
MD5 5dbbf51b93822030168500e468ea09d0
BLAKE2b-256 6fc51a4978f6eb898282d8209b10025dcdc8d8e8221c6890153bc8eb1b5c45bd

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