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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2bbda976d8b59d2d9cd3c784fe980aa1b23eeaf3fc2bba69c23712b1caf7bca |
|
MD5 | c443ce30b72b48964518434786145d88 |
|
BLAKE2b-256 | cc1c55ae9e302a5134b4f6487829ca579f5475c6c9ce9336019d4a2f8419447e |
Hashes for django_lazy_services-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 031d857b3b903f6e9bc1ca1993b931d0fbb0da3bdcbefb08805cf5d183d4ada9 |
|
MD5 | 5dbbf51b93822030168500e468ea09d0 |
|
BLAKE2b-256 | 6fc51a4978f6eb898282d8209b10025dcdc8d8e8221c6890153bc8eb1b5c45bd |