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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcec3665b7d827044e20e1ac814b7bfefb94fd4bfc96565c5f7639e0bf38efd3 |
|
MD5 | 57325a1c737616e909ec258e71d4b7f4 |
|
BLAKE2b-256 | 5e3d94c35181a8e413f0beff8ff6d961485dcb686ff1073b2fd5c1832a6864e1 |
Hashes for django_lazy_services-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18801259ebc52e4aa063ec372c8af9bcd009e86843f47f1abdcc35c0d781b521 |
|
MD5 | c7f693c2f8333035a77b8e837e7d8c73 |
|
BLAKE2b-256 | ea1c76e35f1260dd3ba890beb4d9924fe6f0b8cd58006c6db37ee3718732a7ac |