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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-lazy-services-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a4b52e1c354125306033bf3b34b9481c8ed44764376709310c59986144b20bb |
|
MD5 | a8ffd6bab6578def988b37c2211bd9c8 |
|
BLAKE2b-256 | 87d137cca1db0276ba7e0dc02a673f18fa3068bb172b2d18c4150289924fee22 |
Hashes for django_lazy_services-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bfe8fce78488dabd8c4141eb76d2a6b04095ed01e74fb8006290a0bfbda042f |
|
MD5 | daa7ab1c30516d88d13437d0f2054ef6 |
|
BLAKE2b-256 | 7caf913088070990f49c7e1a62ea4c59df99c8181ab571fc9cde02185ae5e6e4 |